57 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
61 $objWriter->writeAttribute(
'xml:space',
'preserve');
62 $objWriter->writeAttribute(
'xmlns',
'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
63 $objWriter->writeAttribute(
'xmlns:r',
'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
104 $objWriter->writeAttribute(
'lastEdited',
'4');
105 $objWriter->writeAttribute(
'lowestEdited',
'4');
106 $objWriter->writeAttribute(
'rupBuild',
'4505');
124 $objWriter->writeAttribute(
'codeName',
'ThisWorkbook');
144 $objWriter->writeAttribute(
'activeTab', $pPHPExcel->getActiveSheetIndex());
145 $objWriter->writeAttribute(
'autoFilterDateGrouping',
'1');
146 $objWriter->writeAttribute(
'firstSheet',
'0');
148 $objWriter->writeAttribute(
'showHorizontalScroll',
'1');
149 $objWriter->writeAttribute(
'showSheetTabs',
'1');
150 $objWriter->writeAttribute(
'showVerticalScroll',
'1');
151 $objWriter->writeAttribute(
'tabRatio',
'600');
152 $objWriter->writeAttribute(
'visibility',
'visible');
168 if ($pPHPExcel->getSecurity()->isSecurityEnabled()) {
169 $objWriter->startElement(
'workbookProtection');
170 $objWriter->writeAttribute(
'lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ?
'true' :
'false'));
171 $objWriter->writeAttribute(
'lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ?
'true' :
'false'));
172 $objWriter->writeAttribute(
'lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ?
'true' :
'false'));
174 if ($pPHPExcel->getSecurity()->getRevisionsPassword() !=
'') {
175 $objWriter->writeAttribute(
'revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword());
178 if ($pPHPExcel->getSecurity()->getWorkbookPassword() !=
'') {
179 $objWriter->writeAttribute(
'workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword());
200 $objWriter->writeAttribute(
'calcId',
'999999');
201 $objWriter->writeAttribute(
'calcMode',
'auto');
203 $objWriter->writeAttribute(
'calcCompleted', ($recalcRequired) ? 1 : 0);
204 $objWriter->writeAttribute(
'fullCalcOnLoad', ($recalcRequired) ? 0 : 1);
220 $sheetCount = $pPHPExcel->getSheetCount();
221 for ($i = 0; $i < $sheetCount; ++$i) {
225 $pPHPExcel->getSheet($i)->getTitle(),
228 $pPHPExcel->getSheet($i)->getSheetState()
247 if ($pSheetname !=
'') {
250 $objWriter->writeAttribute(
'name', $pSheetname);
251 $objWriter->writeAttribute(
'sheetId', $pSheetId);
252 if ($sheetState !=
'visible' && $sheetState !=
'') {
253 $objWriter->writeAttribute(
'state', $sheetState);
255 $objWriter->writeAttribute(
'r:id',
'rId' . $pRelId);
275 if (count($pPHPExcel->getNamedRanges()) > 0) {
281 $sheetCount = $pPHPExcel->getSheetCount();
282 for ($i = 0; $i < $sheetCount; ++$i) {
307 foreach ($namedRanges as $namedRange) {
330 for ($i = 0; $i < count($range); $i++) {
331 $range[$i][0] =
'\'' . str_replace(
"'",
"''", $pNamedRange->
getWorksheet()->getTitle()) .
'\'!
' . PHPExcel_Cell::absoluteReference($range[$i][0]); 332 if (isset($range[$i][1])) { 333 $range[$i][1] = PHPExcel_Cell::absoluteReference($range[$i][1]); 336 $range = PHPExcel_Cell::buildRange($range); 338 $objWriter->writeRawData($range); 340 $objWriter->endElement(); 351 private function _writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) 353 // definedName for autoFilter 354 $autoFilterRange = $pSheet->getAutoFilter()->getRange(); 355 if (!empty($autoFilterRange)) { 356 $objWriter->startElement('definedName
'); 357 $objWriter->writeAttribute('name
', '_xlnm._FilterDatabase
'); 358 $objWriter->writeAttribute('localSheetId
', $pSheetId); 359 $objWriter->writeAttribute('hidden
', '1
'); 361 // Create absolute coordinate and write as raw text 362 $range = PHPExcel_Cell::splitRange($autoFilterRange); 364 // Strip any worksheet ref so we can make the cell ref absolute 365 if (strpos($range[0],'!
') !== false) { 366 list($ws,$range[0]) = explode('!
',$range[0]); 369 $range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]); 370 $range[1] = PHPExcel_Cell::absoluteCoordinate($range[1]); 371 $range = implode(':
', $range); 373 $objWriter->writeRawData('\
'' . str_replace(
"'",
"''", $pSheet->getTitle()) .
'\'!
' . $range); 375 $objWriter->endElement(); 387 private function _writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) 389 // definedName for PrintTitles 390 if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { 391 $objWriter->startElement('definedName
'); 392 $objWriter->writeAttribute('name
', '_xlnm.Print_Titles
'); 393 $objWriter->writeAttribute('localSheetId
', $pSheetId); 399 if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) { 400 $repeat = $pSheet->getPageSetup()->getColumnsToRepeatAtLeft(); 402 $settingString .= '\
'' . str_replace(
"'",
"''", $pSheet->getTitle()) .
'\'!$
' . $repeat[0] . ':$
' . $repeat[1]; 406 if ($pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) { 407 if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) { 408 $settingString .= ',
'; 411 $repeat = $pSheet->getPageSetup()->getRowsToRepeatAtTop(); 413 $settingString .= '\
'' . str_replace(
"'",
"''", $pSheet->getTitle()) .
'\'!$
' . $repeat[0] . ':$
' . $repeat[1]; 416 $objWriter->writeRawData($settingString); 418 $objWriter->endElement(); 430 private function _writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $pSheetId = 0) 432 // definedName for PrintArea 433 if ($pSheet->getPageSetup()->isPrintAreaSet()) { 434 $objWriter->startElement('definedName
'); 435 $objWriter->writeAttribute('name
', '_xlnm.Print_Area
'); 436 $objWriter->writeAttribute('localSheetId
', $pSheetId); 442 $printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea()); 445 foreach ($printArea as $printAreaRect) { 446 $printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]); 447 $printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]); 448 $chunks[] = '\
'' . str_replace(
"'",
"''", $pSheet->getTitle()) .
'\'!
' . implode(':
', $printAreaRect); 451 $objWriter->writeRawData(implode(',
', $chunks)); 453 $objWriter->endElement(); static splitRange($pRange='A1:A1')
Split range into coordinate strings.
_writeSheets(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel=null)
Write sheets.
_writeCalcPr(PHPExcel_Shared_XMLWriter $objWriter=null, $recalcRequired=TRUE)
Write calcPr.
_writeFileVersion(PHPExcel_Shared_XMLWriter $objWriter=null)
Write file version.
_writeDefinedNameForAutofilter(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Worksheet $pSheet=null, $pSheetId=0)
Write Defined Name for autoFilter.
_writeDefinedNameForPrintTitles(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Worksheet $pSheet=null, $pSheetId=0)
Write Defined Name for PrintTitles.
_writeSheet(PHPExcel_Shared_XMLWriter $objWriter=null, $pSheetname='', $pSheetId=1, $pRelId=1, $sheetState='visible')
Write sheet.
getParentWriter()
Get parent IWriter object.
_writeWorkbookPr(PHPExcel_Shared_XMLWriter $objWriter=null)
Write WorkbookPr.
getNamedRanges()
Get named ranges.
_writeWorkbookProtection(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel=null)
Write WorkbookProtection.
_writeNamedRanges(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel)
Write named ranges.
_writeDefinedNameForNamedRange(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_NamedRange $pNamedRange)
Write Defined Name for named range.
static getExcelCalendar()
Return the Excel calendar (Windows 1900 or Mac 1904)
getLocalOnly()
Get localOnly.
_writeBookViews(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel=null)
Write BookViews.
_writeDefinedNames(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel=null)
Write Defined Names.
const STORAGE_MEMORY
Temporary storage method.
writeWorkbook(PHPExcel $pPHPExcel=null, $recalcRequired=FALSE)
Write workbook to XML format.
_writeDefinedNameForPrintArea(PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Worksheet $pSheet=null, $pSheetId=0)
Write Defined Name for PrintTitles.
getWorksheet()
Get worksheet.