Fixed handling of inline strings in XLSX (#2569)

* Fixed handling of inline strings

* Added an example for the "inline string" datatype for which the generated XML was fixed in the previous commit.

* Handle inline strings exactly the same way as regular strings in the XLS writer, because this is only relevant in the XLSX format.
This commit is contained in:
mweimerskirch
2022-02-12 15:55:48 +01:00
committed by GitHub
parent 5bf0656e92
commit 90e9ea9505
3 changed files with 9 additions and 0 deletions
+6
View File
@@ -1,5 +1,6 @@
<?php
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
@@ -144,6 +145,11 @@ $spreadsheet->getActiveSheet()
$spreadsheet->getActiveSheet()
->setCellValue('C18', '=HYPERLINK("mailto:abc@def.com","abc@def.com")');
$spreadsheet->getActiveSheet()
->setCellValue('A20', 'String')
->setCellValue('B20', 'inline')
->setCellValueExplicit('C20', 'This will not be added to sharedStrings.xml', DataType::TYPE_INLINE);
$spreadsheet->getActiveSheet()
->getColumnDimension('B')
->setAutoSize(true);