Minor performance/memory tweaks to the Excel2007 Writer
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@65356 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
ad3d9dc853
commit
f71aeebd30
|
@ -140,7 +140,9 @@ class PHPExcel_Cell
|
||||||
$this->_parent = $pSheet;
|
$this->_parent = $pSheet;
|
||||||
|
|
||||||
// Set datatype?
|
// Set datatype?
|
||||||
if ($pDataType !== NULL) {
|
if ($pDataType !== null) {
|
||||||
|
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2)
|
||||||
|
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
|
||||||
$this->_dataType = $pDataType;
|
$this->_dataType = $pDataType;
|
||||||
} else {
|
} else {
|
||||||
if (!self::getValueBinder()->bindValue($this, $pValue)) {
|
if (!self::getValueBinder()->bindValue($this, $pValue)) {
|
||||||
|
@ -624,8 +626,7 @@ class PHPExcel_Cell
|
||||||
|
|
||||||
// Extract range
|
// Extract range
|
||||||
if (strpos($pRange, ':') === false) {
|
if (strpos($pRange, ':') === false) {
|
||||||
$rangeA = $pRange;
|
$rangeA = $rangeB = $pRange;
|
||||||
$rangeB = $pRange;
|
|
||||||
} else {
|
} else {
|
||||||
list($rangeA, $rangeB) = explode(':', $pRange);
|
list($rangeA, $rangeB) = explode(':', $pRange);
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
||||||
*
|
*
|
||||||
* @var PHPExcel_Writer_Excel2007_WriterPart[]
|
* @var PHPExcel_Writer_Excel2007_WriterPart[]
|
||||||
*/
|
*/
|
||||||
private $_writerParts;
|
private $_writerParts = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private PHPExcel
|
* Private PHPExcel
|
||||||
|
@ -68,7 +68,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
||||||
*
|
*
|
||||||
* @var string[]
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
private $_stringTable;
|
private $_stringTable = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private unique PHPExcel_Style_Conditional HashTable
|
* Private unique PHPExcel_Style_Conditional HashTable
|
||||||
|
@ -124,7 +124,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $_diskCachingDirectory;
|
private $_diskCachingDirectory = './';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Writer_Excel2007
|
* Create a new PHPExcel_Writer_Excel2007
|
||||||
|
@ -136,9 +136,6 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
||||||
// Assign PHPExcel
|
// Assign PHPExcel
|
||||||
$this->setPHPExcel($pPHPExcel);
|
$this->setPHPExcel($pPHPExcel);
|
||||||
|
|
||||||
// Set up disk caching location
|
|
||||||
$this->_diskCachingDirectory = './';
|
|
||||||
|
|
||||||
$writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
|
$writerPartsArray = array( 'stringtable' => 'PHPExcel_Writer_Excel2007_StringTable',
|
||||||
'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
|
'contenttypes' => 'PHPExcel_Writer_Excel2007_ContentTypes',
|
||||||
'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
|
'docprops' => 'PHPExcel_Writer_Excel2007_DocProps',
|
||||||
|
@ -154,8 +151,7 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
||||||
// Initialise writer parts
|
// Initialise writer parts
|
||||||
// and Assign their parent IWriters
|
// and Assign their parent IWriters
|
||||||
foreach ($writerPartsArray as $writer => $class) {
|
foreach ($writerPartsArray as $writer => $class) {
|
||||||
$this->_writerParts[$writer] = new $class();
|
$this->_writerParts[$writer] = new $class($this);
|
||||||
$this->_writerParts[$writer]->setParentWriter($this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$hashTablesArray = array( '_stylesConditionalHashTable', '_fillHashTable', '_fontHashTable',
|
$hashTablesArray = array( '_stylesConditionalHashTable', '_fillHashTable', '_fontHashTable',
|
||||||
|
@ -163,7 +159,6 @@ class PHPExcel_Writer_Excel2007 implements PHPExcel_Writer_IWriter
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set HashTable variables
|
// Set HashTable variables
|
||||||
$this->_stringTable = array();
|
|
||||||
foreach ($hashTablesArray as $tableName) {
|
foreach ($hashTablesArray as $tableName) {
|
||||||
$this->$tableName = new PHPExcel_HashTable();
|
$this->$tableName = new PHPExcel_HashTable();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,4 +65,17 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
|
||||||
throw new Exception("No parent PHPExcel_Writer_IWriter assigned.");
|
throw new Exception("No parent PHPExcel_Writer_IWriter assigned.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set parent IWriter object
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Writer_IWriter $pWriter
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function __construct(PHPExcel_Writer_IWriter $pWriter = null) {
|
||||||
|
if (!is_null($pWriter)) {
|
||||||
|
$this->_parentWriter = $pWriter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue