-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
This is:
- [ phpspreadsheet] a bug report
What is the expected behavior?
when i imported data from a normal xls file, some columns get a wrong formula(not only wrong calculated result but also wrong formula expression) :
this is the write formula in the original xls file:

What is the current behavior?
this is what it got after imported with phpspreadsheet

but some other formula was just right, I dont why. pls help me out.
What are the steps to reproduce?
<?php
// some code here...
$inputFileType = \PhpOffice\PhpSpreadsheet\IOFactory::identify($filename);
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
$reader->setReadDataOnly(true);
$spreadsheet = $reader->load($filename);
$worksheet = $spreadsheet->getActiveSheet();
$sheetAllCount = $spreadsheet->getSheetCount();
for ($index = 0; $index < $sheetAllCount; $index++) {
$title[] = $spreadsheet->getSheet($index)->getTitle();
}
\PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance($spreadsheet)->disableCalculationCache();
\PhpOffice\PhpSpreadsheet\Calculation\Calculation::getInstance($spreadsheet)->clearCalculationCache();
$sheet = $spreadsheet->getSheet($whatTable);
$highest_row = $sheet->getHighestRow();
$highest_column = $sheet->getHighestColumn();
$highestColumnIndex = Coordinate::columnIndexFromString($highest_column);
for ($i = 1; $i <= $highestColumnIndex; $i++) {
for ($j = 1; $j <= $highest_row; $j++) {
$conent = $sheet->getCellByColumnAndRow($i, $j)->getValue();
//$conent = $sheet->getCellByColumnAndRow($i, $j)->getCalculatedValue();
// $conent = $sheet->getCellByColumnAndRow($i, $j)->getCalculatedValue();
$info[$j][$i] = $conent;
}
}
var_dump($info);exit;Which versions of PhpSpreadsheet and PHP are affected?
latest 1.14.0
Metadata
Metadata
Assignees
Labels
No labels