{
if (ini_get('mbstring.func_overload') != 0) {
throw new Exception(
'Multibyte string function overloading in PHP must be disabled.');
}
$this->_phpExcel->garbageCollect();
$this->_str_total, $this->_str_unique, $this->_str_table, $this->_parser, $this->_tempDir);
$countSheets = count($this->_phpExcel->getAllSheets());
for ($i = 0; $i < $countSheets; ++$i) {
$phpSheet = $this->_phpExcel->getSheet($i);
$this->_str_total, $this->_str_unique,
$this->_str_table,
$this->_parser, $this->_tempDir,
$phpSheet);
$this->_writerWorksheets[$i] = $writerWorksheet;
}
$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';
if ($this->_tempDir != '') {
$OLE->setTempDir($this->_tempDir);
}
$worksheetSizes = array();
for ($i = 0; $i < $countSheets; ++$i) {
$this->_writerWorksheets[$i]->close();
$worksheetSizes[] = $this->_writerWorksheets[$i]->_datasize;
}
$OLE->append( $this->_writerWorkbook->writeWorkbook($worksheetSizes) );
for ($i = 0; $i < $countSheets; ++$i) {
while ( ($tmp = $this->_writerWorksheets[$i]->getData()) !== false ) {
$OLE->append($tmp);
}
}
if ($this->_tempDir != '') {
$root->setTempDir($this->_tempDir);
}
$res = $root->save($pFilename);
foreach ($this->_writerWorksheets as $sheet) {
$sheet->cleanup();
}
}