Skip to content

Commit b949dab

Browse files
committed
fix: properly set string values in exports to escape formulas
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 2914a2e commit b949dab

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

lib/Service/SubmissionService.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,12 @@ private function exportData(array $header, array $data, string $fileFormat, ?Fil
339339
->getAlignment()
340340
->setWrapText(true);
341341
} else {
342-
$activeWorksheet->setCellValue([$column, $row], $value);
343-
344-
// Quote cell values that start with '=' to prevent evaluation of formulas
342+
// Explicitly set the type of the value to string for values that start with '=' to prevent it being interpreted as formulas
345343
if (is_string($value) && str_starts_with($value, '=')) {
346-
$activeWorksheet->getCell([$column, $row])->getStyle()->setQuotePrefix(true);
344+
$activeWorksheet->getCell([$column, $row])
345+
->setValueExplicit($value);
346+
} else {
347+
$activeWorksheet->setCellValue([$column, $row], $value);
347348
}
348349
}
349350
}

0 commit comments

Comments
 (0)