From bc6d1bee46a5c992b84332565abf76ce89edb4c8 Mon Sep 17 00:00:00 2001 From: Christian Hartmann Date: Wed, 2 Apr 2025 23:31:59 +0200 Subject: [PATCH] fix: quote cell values to prevent formula evaluation Signed-off-by: Christian Hartmann --- lib/Service/SubmissionService.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Service/SubmissionService.php b/lib/Service/SubmissionService.php index 68d9d09e0..0ef7d74d5 100644 --- a/lib/Service/SubmissionService.php +++ b/lib/Service/SubmissionService.php @@ -319,6 +319,11 @@ private function exportData(array $header, array $data, string $fileFormat, ?Fil ->setWrapText(true); } else { $activeWorksheet->setCellValue([$column, $row], $value); + + // Quote cell values that start with '=' to prevent evaluation of formulas + if (is_string($value) && str_starts_with($value, '=')) { + $activeWorksheet->getCell([$column, $row])->getStyle()->setQuotePrefix(true); + } } } }