Source for file Excel5.php
Documentation is available at Excel5.php
* Copyright (c) 2006 - 2009 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 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.6.7, 2009-04-22
require_once 'PHPExcel/Writer/IWriter.php';
require_once 'PHPExcel/Cell.php';
/** PHPExcel_Writer_Excel5_Workbook */
require_once 'PHPExcel/Writer/Excel5/Workbook.php';
/** PHPExcel_HashTable */
require_once 'PHPExcel/HashTable.php';
* @package PHPExcel_Writer_Excel5
* @copyright Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
* Temporary storage directory
* Create a new PHPExcel_Writer_Excel5
* @param PHPExcel $phpExcel PHPExcel object
* @param string $pFileName
public function save($pFilename = null) {
$workbook->setVersion(8);
// Add 15 style Xf's plus 1 cell Xf. Why?
for ($i = 0; $i < 15; ++ $i) {
$workbook->addXfWriter($phpExcel->getSheet(0)->getDefaultStyle(), true);
$workbook->addXfWriter($phpExcel->getSheet(0)->getDefaultStyle());
$cellStyleHashes->addFromSource( $allStyles );
foreach ($allStyles as $style) {
$styleHashIndex = $style->getHashIndex();
if(isset ($addedStyles[$styleHashIndex])) continue;
// mapping between PHPExcel style hash index and BIFF XF index
$xfIndexes[$styleHashIndex] = $workbook->addXfWriter($style);
$addedStyles[$style->getHashIndex()] = true;
foreach ($phpExcel->getSheetNames() as $sheetIndex => $sheetName) {
$phpSheet = $phpExcel->getSheet($sheetIndex);
$worksheet = $workbook->addWorksheet($phpSheet, $xfIndexes);
* Get an array of all styles
* @param PHPExcel $pPHPExcel
* @return PHPExcel_Style[] All styles in PHPExcel
private function _allStyles(PHPExcel $pPHPExcel = null)
// Get an array of all styles
for ($i = 0; $i < $pPHPExcel->getSheetCount(); ++ $i) {
foreach ($pPHPExcel->getSheet($i)->getStyles() as $style) {
* Get temporary storage directory
* Set temporary storage directory
* @param string $pValue Temporary storage directory
* @throws Exception Exception when directory does not exist
throw new Exception("Directory does not exist: $pValue");
|