-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Excel 2007 Reader freezes because of conditional formatting #575
Comments
If you consider that the line While combining the lines:
as
would improve things a bit, it's not going to be fast building that list and then iterating over that many cells, applying the conditionals to each in turn Being able to use a Generator for |
17 rows and 18 columns xslx file causes: Fatal error: Allowed memory size of 4244635648 bytes exhausted (tried to allocate 234881040 bytes) in (...)/classes/PHPExcel/Cell.php on line 909 $returnValue contain 14680064 items and array_unique can't handle it. |
If you only want to read the data you can use the following snippet (for the excel reader): $objReader = PHPExcel_IOFactory::createReader("Excel2007");
$objReader->setReadDataOnly(true); This skips the formatting options and loads a lot faster! |
It's a big problem here. Why it happen/is need? |
I found a solution. Just replace (file
By:
I don't know why the current method is used, because in this case, the conditional styles should be copied only. In current version, if you have a selected area with 100 cells, for instance, by with an unique conditional formatting, the result file will have 100 different definitions to this same conditional formatting. |
PHPExcel version: 1.8
PHP version: 5.3.10-1ubuntu3 with Suhosin-Patch
Code causing the issue:
The Excel file causing the issue contains the following conditional formatting:
Details:
When I load this Excel file (in non-read-only mode), the script takes 100% CPU and the memory load increases radically.
The load() method of the Reader never ends.
I tried to debug a bit, and at first sight, it seems that the slowness comes frome here :
In particular this line :
$aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($ref);
is really slow.Its first execution is fine, but the second never ends (when called with
$ref = 'A1:J1048576'
).Has anyone already experienced this issue? Is it a PHPExcel bug, or does it come from my conditionals formatting, which are over the whole sheet?
The text was updated successfully, but these errors were encountered: