Skip to content

Commit 3ef3fcf

Browse files
Upgrade to PHPSpreadsheet & replace depricated function & prevent null since HTMLHelper does not support it anymore (#330)
1 parent 2c41aae commit 3ef3fcf

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"friendsofphp/php-cs-fixer": "^v3.40.0",
4141
"mongodb/mongodb": "^1.17",
4242
"ocramius/package-versions": "^2.8",
43-
"phpoffice/phpspreadsheet": "^1.29.0",
43+
"phpoffice/phpspreadsheet": "^2.0",
4444
"phpstan/extension-installer": "^1.3.1",
4545
"phpstan/phpstan": "^1.10.55",
4646
"phpstan/phpstan-doctrine": "^1.3.54",

src/Exporter/Excel/ExcelExporter.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
namespace Omines\DataTablesBundle\Exporter\Excel;
1414

1515
use Omines\DataTablesBundle\Exporter\DataTableExporterInterface;
16+
use PhpOffice\PhpSpreadsheet\Cell\CellAddress;
1617
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
1718
use PhpOffice\PhpSpreadsheet\Helper;
1819
use PhpOffice\PhpSpreadsheet\Spreadsheet;
@@ -42,7 +43,7 @@ public function export(array $columnNames, \Iterator $data): \SplFileInfo
4243
foreach ($data as $row) {
4344
$colIndex = 1;
4445
foreach ($row as $value) {
45-
$sheet->setCellValueByColumnAndRow($colIndex++, $rowIndex, $htmlHelper->toRichTextObject($value));
46+
$sheet->getCell(CellAddress::fromColumnAndRow($colIndex++, $rowIndex))->setValue($htmlHelper->toRichTextObject($value ?? ''));
4647
}
4748
++$rowIndex;
4849
}

0 commit comments

Comments
 (0)