Skip to content

Commit

Permalink
T&A 43220: fix Excel Export by adding file extension (ILIAS-eLearning…
Browse files Browse the repository at this point in the history
…#8732)

* fix: add missing file extension when exporting excel file

* refactor: check file extension before writing file
  • Loading branch information
lukas-heinrich authored Dec 18, 2024
1 parent a6ea3c8 commit a8cd7c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/ILIAS/Test/src/ExportImport/ResultsExportExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ public function withUserPages(): self
public function write(): ?string
{
$path = \ilFileUtils::ilTempnam() . $this->filename;

$this->worksheet->setFormat(\ilExcel::FORMAT_XML);
$extension = '.' . strtolower(\ilExcel::FORMAT_XML);
if (!str_ends_with($path, $extension)) {
$path .= $extension;
}

$this->worksheet->writeToFile($path);
return $path;
}
Expand Down

0 comments on commit a8cd7c8

Please sign in to comment.