Skip to content

Commit 6c8a698

Browse files
authored
Merge pull request #2674 from nextcloud/fix/quote-cell-values
fix: quote cell values to prevent formula evaluation
2 parents ac631c0 + c745e16 commit 6c8a698

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/Service/SubmissionService.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ private function exportData(array $header, array $data, string $fileFormat, ?Fil
312312
->setWrapText(true);
313313
} else {
314314
$activeWorksheet->setCellValue([$column, $row], $value);
315+
316+
// Quote cell values that start with '=' to prevent evaluation of formulas
317+
if (is_string($value) && str_starts_with($value, '=')) {
318+
$activeWorksheet->getCell([$column, $row])->getStyle()->setQuotePrefix(true);
319+
}
315320
}
316321
}
317322
}

0 commit comments

Comments
 (0)