General: Improved memory usage in CSV Writer

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@73146 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-05-11 22:36:47 +00:00
parent adacb26028
commit 85ff71fd18
2 changed files with 9 additions and 4 deletions

View File

@ -118,12 +118,16 @@ class PHPExcel_Writer_CSV implements PHPExcel_Writer_IWriter {
fwrite($fileHandle, "\xEF\xBB\xBF"); fwrite($fileHandle, "\xEF\xBB\xBF");
} }
// Convert sheet to array // Identify the range that we need to extract from the worksheet
$cellsArray = $sheet->toArray('', $this->_preCalculateFormulas); $maxCol = $sheet->getHighestColumn();
$maxRow = $sheet->getHighestRow();
// Write rows to file // Write rows to file
foreach ($cellsArray as $row) { for($row = 1; $row <= $maxRow; ++$row) {
$this->_writeLine($fileHandle, $row); // Convert the row to an array...
$cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row,'', $this->_preCalculateFormulas);
// ... and write to the file
$this->_writeLine($fileHandle, $cellsArray[0]);
} }
// Close file // Close file

View File

@ -26,6 +26,7 @@
Fixed in SVN: Fixed in SVN:
- General: (MBaker) Fix to build to ensure that Examples are included with the documentation - General: (MBaker) Fix to build to ensure that Examples are included with the documentation
- General: (MBaker) Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed - General: (MBaker) Reduce cell caching overhead using dirty flag to ensure that cells are only rewritten to the cache if they have actually been changed
- General: (MBaker) Improved memory usage in CSV Writer
- Bugfix: (MBaker) Work item 15459 - Invalid cell coordinate in Autofilter for Excel2007 Writer - Bugfix: (MBaker) Work item 15459 - Invalid cell coordinate in Autofilter for Excel2007 Writer
- Bugfix: (MBaker) Work item 15518 - PCLZip library issue - Bugfix: (MBaker) Work item 15518 - PCLZip library issue
- Bugfix: (MBaker) Work item 15537 - Excel2007 Reader canRead function bug - Bugfix: (MBaker) Work item 15537 - Excel2007 Reader canRead function bug