Minor performance/memory tweaks to the Excel2007 Writer

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@65288 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-12-14 17:57:15 +00:00
parent aa213fe236
commit 20eec570ff
1 changed files with 24 additions and 21 deletions

View File

@ -139,31 +139,34 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
// Set up disk caching location // Set up disk caching location
$this->_diskCachingDirectory = './'; $this->_diskCachingDirectory = './';
// Initialise writer parts $writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
$this->_writerParts['stringtable'] = new PHPExcel_Writer_Excel2007_StringTable(); 'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
$this->_writerParts['contenttypes'] = new PHPExcel_Writer_Excel2007_ContentTypes(); 'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
$this->_writerParts['docprops'] = new PHPExcel_Writer_Excel2007_DocProps(); 'rels' => 'PHPExcel_Writer_Excel2007_Rels',
$this->_writerParts['rels'] = new PHPExcel_Writer_Excel2007_Rels(); 'theme' => 'PHPExcel_Writer_Excel2007_Theme',
$this->_writerParts['theme'] = new PHPExcel_Writer_Excel2007_Theme(); 'style' => 'PHPExcel_Writer_Excel2007_Style',
$this->_writerParts['style'] = new PHPExcel_Writer_Excel2007_Style(); 'workbook' => 'PHPExcel_Writer_Excel2007_Workbook',
$this->_writerParts['workbook'] = new PHPExcel_Writer_Excel2007_Workbook(); 'worksheet' => 'PHPExcel_Writer_Excel2007_Worksheet',
$this->_writerParts['worksheet'] = new PHPExcel_Writer_Excel2007_Worksheet(); 'drawing' => 'PHPExcel_Writer_Excel2007_Drawing',
$this->_writerParts['drawing'] = new PHPExcel_Writer_Excel2007_Drawing(); 'comments' => 'PHPExcel_Writer_Excel2007_Comments'
$this->_writerParts['comments'] = new PHPExcel_Writer_Excel2007_Comments(); );
// Assign parent IWriter // Initialise writer parts
foreach ($this->_writerParts as $writer) { // and Assign their parent IWriters
$writer->setParentWriter($this); foreach ($writerPartsArray as $writer => $class) {
$this->_writerParts[$writer] = new $class();
$this->_writerParts[$writer]->setParentWriter($this);
} }
$hashTablesArray = array( '_stylesConditionalHashTable', '_fillHashTable', '_fontHashTable',
'_bordersHashTable', '_numFmtHashTable', '_drawingHashTable'
);
// Set HashTable variables // Set HashTable variables
$this->_stringTable = array(); $this->_stringTable = array();
$this->_stylesConditionalHashTable = new PHPExcel_HashTable(); foreach ($hashTablesArray as $tableName) {
$this->_fillHashTable = new PHPExcel_HashTable(); $this->$tableName = new PHPExcel_HashTable();
$this->_fontHashTable = new PHPExcel_HashTable(); }
$this->_bordersHashTable = new PHPExcel_HashTable();
$this->_numFmtHashTable = new PHPExcel_HashTable();
$this->_drawingHashTable = new PHPExcel_HashTable();
} }
/** /**