Source for file Excel5.php
Documentation is available at Excel5.php
* Copyright (c) 2006 - 2010 PHPExcel
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @package PHPExcel_Writer_Excel5
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.3c, 2010-06-01
* @package PHPExcel_Writer_Excel5
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
private $_preCalculateFormulas;
* The BIFF version of the written Excel file, BIFF5 = 0x0500, BIFF8 = 0x0600
* Total number of shared strings in workbook
* Number of unique shared strings in workbook
* Array of unique shared strings in workbook
* Color cache. Mapping between RGB value and color index.
* @var PHPExcel_Writer_Excel5_Parser
* Create a new PHPExcel_Writer_Excel5
* @param PHPExcel $phpExcel PHPExcel object
$this->_preCalculateFormulas = true;
$this->_phpExcel = $phpExcel;
$this->_BIFF_version = 0x0600;
$this->_str_table = array();
* @param string $pFileName
public function save($pFilename = null) {
$this->_phpExcel->garbageCollect();
// initialize colors array
$this->_colors = array();
// Initialise workbook writer
$this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
// add 15 identical cell style Xfs
// for now, we use the first cellXf instead of cellStyleXf
$cellXfCollection = $this->_phpExcel->getCellXfCollection();
for ($i = 0; $i < 15; ++ $i) {
$this->_writerWorkbook->addXfWriter($cellXfCollection[0], true);
foreach ($this->_phpExcel->getCellXfCollection() as $style) {
$this->_writerWorkbook->addXfWriter($style, false);
$workbookStreamName = ($this->_BIFF_version == 0x0600) ? 'Workbook' : 'Book';
// Initialise worksheet writers
$countSheets = $this->_phpExcel->getSheetCount();
// Write the worksheet streams before the global workbook stream,
// because the byte sizes of these are needed in the global workbook stream
$worksheetSizes = array();
for ($i = 0; $i < $countSheets; ++ $i) {
$this->_str_total, $this->_str_unique,
$this->_str_table, $this->_colors,
$this->_preCalculateFormulas,
$this->_phpExcel->getSheet($i));
$this->_writerWorksheets[$i]->close();
$worksheetSizes[] = $this->_writerWorksheets[$i]->_datasize;
// add binary data for global workbook stream
$OLE->append( $this->_writerWorkbook->writeWorkbook($worksheetSizes) );
// add binary data for sheet streams
for ($i = 0; $i < $countSheets; ++ $i) {
$OLE->append($this->_writerWorksheets[$i]->getData());
$res = $root->save($pFilename);
* Set temporary storage directory
* @param string $pValue Temporary storage directory
* @throws Exception Exception when directory does not exist
* @return PHPExcel_Writer_Excel5
* Get Pre-Calculate Formulas
return $this->_preCalculateFormulas;
* Set Pre-Calculate Formulas
* @param boolean $pValue Pre-Calculate Formulas?
$this->_preCalculateFormulas = $pValue;
|