Skip to content

Commit b051d49

Browse files
committed
Use CELL("width") As Another Unimplemented Array Function
I might want to implement CHOOSECOLS after this PR is merged.
1 parent 2076a07 commit b051d49

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

src/PhpSpreadsheet/Reader/Xlsx.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ protected function loadSpreadsheetFromFile(string $filename): Spreadsheet
854854

855855
break;
856856
case 'b':
857-
if (!isset($c->f)) {
857+
if (!isset($c->f) || ((string) $c->f) === '') {
858858
if (isset($c->v)) {
859859
$value = self::castToBoolean($c);
860860
} else {

tests/PhpSpreadsheetTests/Writer/Xlsx/ArrayFunctionsTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@ public function testUnimplementedArrayOutput(): void
285285
];
286286
$actualFG = $sheet2->rangeToArray('F1:G5');
287287
self::assertSame($expectedFG, $actualFG);
288+
self::assertSame('=CELL("width")', $sheet2->getCell('I1')->getValue());
289+
self::assertSame(8, $sheet2->getCell('I1')->getCalculatedValue());
290+
self::assertTrue($sheet2->getCell('J1')->getValue());
288291
$spreadsheet2->disconnectWorksheets();
289292

290293
$file = 'zip://';
@@ -295,6 +298,7 @@ public function testUnimplementedArrayOutput(): void
295298
self::fail('Unable to read file');
296299
} else {
297300
self::assertStringContainsString('<f t="array" ref="F1:G5" aca="1" ca="1">_xlfn.CHOOSECOLS(A1:C5,3,1)</f><v>11</v>', $data);
301+
self::assertStringContainsString('<f t="array" ref="I1:J1" aca="1" ca="1">CELL(&quot;width&quot;)</f><v>8</v></c><c r="J1" t="b"><v>1</v></c>', $data);
298302
}
299303
}
300304

74 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)