From 753dadbc11f3f87f9739084853fd1734fc922945 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 25 Jun 2025 17:41:34 +0200 Subject: [PATCH] fix: properly set string values in exports to escape formulas Signed-off-by: Ferdinand Thiessen --- lib/Service/SubmissionService.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Service/SubmissionService.php b/lib/Service/SubmissionService.php index 0ef7d74d5..2e31ea7c9 100644 --- a/lib/Service/SubmissionService.php +++ b/lib/Service/SubmissionService.php @@ -318,11 +318,12 @@ private function exportData(array $header, array $data, string $fileFormat, ?Fil ->getAlignment() ->setWrapText(true); } else { - $activeWorksheet->setCellValue([$column, $row], $value); - - // Quote cell values that start with '=' to prevent evaluation of formulas + // Explicitly set the type of the value to string for values that start with '=' to prevent it being interpreted as formulas if (is_string($value) && str_starts_with($value, '=')) { - $activeWorksheet->getCell([$column, $row])->getStyle()->setQuotePrefix(true); + $activeWorksheet->getCell([$column, $row]) + ->setValueExplicit($value); + } else { + $activeWorksheet->setCellValue([$column, $row], $value); } } }