You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [x] a bug report
- [ ] a feature request
- [ x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
After using insertNewRowBefore, the number of rows becomes $sheet->getHighestRow() + $numberOfRow
After saving the file becomes ~350Kbytes. Template source file 15Kbytes
What is the current behavior?
i think the rows should be $sheet->getHighestDataRow() + $numberOfRow
FixPHPOffice#3687. Worksheet methods insertNewRowBefore and insertNewColumnBefore call ReferenceHelper insertNewBefore. That function fills in "missing" cells with null values. However, for boundaries, it uses getHighestRow and getHighestColumn. It should be sufficient to use getHighestDataRow and getHighestDataColumn. When there is a big gap between getHighest... and getHighestData..., this can result in a big increase in memory usage, and in file space when saving the spreadsheet. New test InsertTest demonstrates the problem by populating a worksheet with cells A1:D5 (so highestDataRow is 5), but also setting row 1000 to invisible (so highestRow is 1000).
The major part of the change is in ReferenceHelper::insertNewBefore, which will now use getHighestData... for its boundaries when filling in the missing cells. Changes of less impact are made to duplicateStylesByColumn and duplicateStylesByRow so that cells which don't yet exist are not created unless the style that will be applied is not the workbook default style.
As for reducing the file size, Writer/Xlsx/Worksheet is changed so that cells whose value is null or null-string and which use the workbook default style are not written to the output spreadsheet. This requires some changes to existing test ReadBlankCellsTest; I don't think the difference should matter to the end-user.
This is:
What is the expected behavior?
After using insertNewRowBefore, the number of rows becomes $sheet->getHighestRow() + $numberOfRow
After saving the file becomes ~350Kbytes. Template source file 15Kbytes
What is the current behavior?
i think the rows should be $sheet->getHighestDataRow() + $numberOfRow
What are the steps to reproduce?
What features do you think are causing the issue
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
xlsx
Which versions of PhpSpreadsheet and PHP are affected?
1.29.0
The text was updated successfully, but these errors were encountered: