* fix #1114 issues * fixed code style * update for all version * add test for bag 1114 * remove comment Co-authored-by: georgio <georgiokot@gmail.cim>
This commit is contained in:
parent
90b9decb8e
commit
fea0e34e90
|
|
@ -3749,12 +3749,10 @@ class Xls extends BaseReader
|
|||
} else {
|
||||
$textRun = $richText->createTextRun($text);
|
||||
if (isset($fmtRuns[$i - 1])) {
|
||||
if ($fmtRuns[$i - 1]['fontIndex'] < 4) {
|
||||
$fontIndex = $fmtRuns[$i - 1]['fontIndex'];
|
||||
} else {
|
||||
// this has to do with that index 4 is omitted in all BIFF versions for some strange reason
|
||||
// check the OpenOffice documentation of the FONT record
|
||||
$fontIndex = $fmtRuns[$i - 1]['fontIndex'] - 1;
|
||||
|
||||
if (array_key_exists($fontIndex, $this->objFonts) === false) {
|
||||
$fontIndex = count($this->objFonts) - 1;
|
||||
}
|
||||
$textRun->setFont(clone $this->objFonts[$fontIndex]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,4 +121,13 @@ class XlsTest extends AbstractFunctional
|
|||
self::assertSame('Ładowność', $sheet->getCell('I1')->getValue());
|
||||
$spreadsheet->disconnectWorksheets();
|
||||
}
|
||||
|
||||
public function testLoadXlsBug1114(): void
|
||||
{
|
||||
$filename = 'tests/data/Reader/XLS/bug1114.xls';
|
||||
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($filename);
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
self::assertSame(1148140800.0, $sheet->getCell('B2')->getValue());
|
||||
$spreadsheet->disconnectWorksheets();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue