'PhpSpreadsheet - added row exceeds row limit in file
I have a template file for creating files filled with data. The template file contains header, footer and one data row, which i clone (and copy it's style) according to my needs. The problem is that despite the fact that the template file has ~200 rows, if I add a single row, then when I try to open that file it complains that "Maximum number of rows was exceeded".
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader('Xlsx');
$info = $reader->listWorksheetInfo($filename);
// $info[0]['totalRows'] = 1048576 - so the maximum for Xlsx
This way everything works, no error on PHP side, but LibreOffice complains and the operation is extremely slow and memory consuming (especially inserting rows with insertRowsBefore, as it seems to iterate over all the cells to recalculate).
The Worksheet::calculateWorksheetDataDimension() method returns A1:HJ221 and if I apply a ReadFilter to read only rows and columns within the data dimensions... the columnns' width and height are gone. I'm not able to set them manually as header and footer are very complex. If I load the whole file then width, height and all styles are perfect, but operation is veeeery slow and consumes a lot of memory.
Any ideas why this happens? And how to avoid that?
PHP7.4 PHPSpreadsheet 1.22
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
