ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Writer_Excel2007_Workbook Class Reference
+ Inheritance diagram for PHPExcel_Writer_Excel2007_Workbook:
+ Collaboration diagram for PHPExcel_Writer_Excel2007_Workbook:

Public Member Functions

 writeWorkbook (PHPExcel $pPHPExcel=null)
 Write workbook to XML format.
- Public Member Functions inherited from PHPExcel_Writer_Excel2007_WriterPart
 setParentWriter (PHPExcel_Writer_IWriter $pWriter=null)
 Set parent IWriter object.
 getParentWriter ()
 Get parent IWriter object.
 __construct (PHPExcel_Writer_IWriter $pWriter=null)
 Set parent IWriter object.

Private Member Functions

 _writeFileVersion (PHPExcel_Shared_XMLWriter $objWriter=null)
 Write file version.
 _writeWorkbookPr (PHPExcel_Shared_XMLWriter $objWriter=null)
 Write WorkbookPr.
 _writeBookViews (PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel=null)
 Write BookViews.
 _writeWorkbookProtection (PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel=null)
 Write WorkbookProtection.
 _writeCalcPr (PHPExcel_Shared_XMLWriter $objWriter=null)
 Write calcPr.
 _writeSheets (PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel=null)
 Write sheets.
 _writeSheet (PHPExcel_Shared_XMLWriter $objWriter=null, $pSheetname= '', $pSheetId=1, $pRelId=1, $sheetState= 'visible')
 Write sheet.
 _writeDefinedNames (PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel=null)
 Write Defined Names.
 _writeNamedRanges (PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel $pPHPExcel)
 Write named ranges.
 _writeDefinedNameForNamedRange (PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_NamedRange $pNamedRange)
 Write Defined Name for autoFilter.
 _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.
 _writeDefinedNameForPrintArea (PHPExcel_Shared_XMLWriter $objWriter=null, PHPExcel_Worksheet $pSheet=null, $pSheetId=0)
 Write Defined Name for PrintTitles.

Detailed Description

Definition at line 36 of file Workbook.php.

Member Function Documentation

PHPExcel_Writer_Excel2007_Workbook::_writeBookViews ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel  $pPHPExcel = null 
)
private

Write BookViews.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel$pPHPExcel
Exceptions
Exception

Definition at line 135 of file Workbook.php.

Referenced by writeWorkbook().

{
// bookViews
$objWriter->startElement('bookViews');
// workbookView
$objWriter->startElement('workbookView');
$objWriter->writeAttribute('activeTab', $pPHPExcel->getActiveSheetIndex());
$objWriter->writeAttribute('autoFilterDateGrouping', '1');
$objWriter->writeAttribute('firstSheet', '0');
$objWriter->writeAttribute('minimized', '0');
$objWriter->writeAttribute('showHorizontalScroll', '1');
$objWriter->writeAttribute('showSheetTabs', '1');
$objWriter->writeAttribute('showVerticalScroll', '1');
$objWriter->writeAttribute('tabRatio', '600');
$objWriter->writeAttribute('visibility', 'visible');
$objWriter->endElement();
$objWriter->endElement();
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeCalcPr ( PHPExcel_Shared_XMLWriter  $objWriter = null)
private

Write calcPr.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
Exceptions
Exception

Definition at line 191 of file Workbook.php.

Referenced by writeWorkbook().

{
$objWriter->startElement('calcPr');
$objWriter->writeAttribute('calcId', '124519');
$objWriter->writeAttribute('calcMode', 'auto');
$objWriter->writeAttribute('fullCalcOnLoad', '1');
$objWriter->endElement();
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeDefinedNameForAutofilter ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel_Worksheet  $pSheet = null,
  $pSheetId = 0 
)
private

Write Defined Name for autoFilter.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel_Worksheet$pSheet
int$pSheetId
Exceptions
Exception

Definition at line 344 of file Workbook.php.

Referenced by _writeDefinedNames().

{
// definedName for autoFilter
if ($pSheet->getAutoFilter() != '') {
$objWriter->startElement('definedName');
$objWriter->writeAttribute('name', '_xlnm._FilterDatabase');
$objWriter->writeAttribute('localSheetId', $pSheetId);
$objWriter->writeAttribute('hidden', '1');
// Create absolute coordinate and write as raw text
$range = $range[0];
$range[0] = PHPExcel_Cell::absoluteCoordinate($range[0]);
$range[1] = PHPExcel_Cell::absoluteCoordinate($range[1]);
$range = implode(':', $range);
$objWriter->writeRawData('\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . $range);
$objWriter->endElement();
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeDefinedNameForNamedRange ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel_NamedRange  $pNamedRange 
)
private

Write Defined Name for autoFilter.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel_NamedRange$pNamedRange
Exceptions
Exception

Definition at line 312 of file Workbook.php.

References PHPExcel_NamedRange\getLocalOnly(), PHPExcel_NamedRange\getName(), PHPExcel_NamedRange\getRange(), PHPExcel_NamedRange\getScope(), PHPExcel_NamedRange\getWorksheet(), and PHPExcel_Cell\splitRange().

Referenced by _writeNamedRanges().

{
// definedName for named range
$objWriter->startElement('definedName');
$objWriter->writeAttribute('name', $pNamedRange->getName());
if ($pNamedRange->getLocalOnly()) {
$objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope()));
}
// Create absolute coordinate and write as raw text
$range = PHPExcel_Cell::splitRange($pNamedRange->getRange());
for ($i = 0; $i < count($range); $i++) {
$range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . PHPExcel_Cell::absoluteReference($range[$i][0]);
if (isset($range[$i][1])) {
$range[$i][1] = PHPExcel_Cell::absoluteReference($range[$i][1]);
}
}
$range = PHPExcel_Cell::buildRange($range);
$objWriter->writeRawData($range);
$objWriter->endElement();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeDefinedNameForPrintArea ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel_Worksheet  $pSheet = null,
  $pSheetId = 0 
)
private

Write Defined Name for PrintTitles.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel_Worksheet$pSheet
int$pSheetId
Exceptions
Exception

Definition at line 417 of file Workbook.php.

Referenced by _writeDefinedNames().

{
// definedName for PrintArea
if ($pSheet->getPageSetup()->isPrintAreaSet()) {
$objWriter->startElement('definedName');
$objWriter->writeAttribute('name', '_xlnm.Print_Area');
$objWriter->writeAttribute('localSheetId', $pSheetId);
// Setting string
$settingString = '';
// Print area
$printArea = PHPExcel_Cell::splitRange($pSheet->getPageSetup()->getPrintArea());
$chunks = array();
foreach ($printArea as $printAreaRect) {
$printAreaRect[0] = PHPExcel_Cell::absoluteReference($printAreaRect[0]);
$printAreaRect[1] = PHPExcel_Cell::absoluteReference($printAreaRect[1]);
$chunks[] = '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!' . implode(':', $printAreaRect);
}
$objWriter->writeRawData(implode(',', $chunks));
$objWriter->endElement();
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeDefinedNameForPrintTitles ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel_Worksheet  $pSheet = null,
  $pSheetId = 0 
)
private

Write Defined Name for PrintTitles.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel_Worksheet$pSheet
int$pSheetId
Exceptions
Exception

Definition at line 374 of file Workbook.php.

Referenced by _writeDefinedNames().

{
// definedName for PrintTitles
if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet() || $pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
$objWriter->startElement('definedName');
$objWriter->writeAttribute('name', '_xlnm.Print_Titles');
$objWriter->writeAttribute('localSheetId', $pSheetId);
// Setting string
$settingString = '';
// Columns to repeat
if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) {
$repeat = $pSheet->getPageSetup()->getColumnsToRepeatAtLeft();
$settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1];
}
// Rows to repeat
if ($pSheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
if ($pSheet->getPageSetup()->isColumnsToRepeatAtLeftSet()) {
$settingString .= ',';
}
$repeat = $pSheet->getPageSetup()->getRowsToRepeatAtTop();
$settingString .= '\'' . str_replace("'", "''", $pSheet->getTitle()) . '\'!$' . $repeat[0] . ':$' . $repeat[1];
}
$objWriter->writeRawData($settingString);
$objWriter->endElement();
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeDefinedNames ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel  $pPHPExcel = null 
)
private

Write Defined Names.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel$pPHPExcel
Exceptions
Exception

Definition at line 262 of file Workbook.php.

References _writeDefinedNameForAutofilter(), _writeDefinedNameForPrintArea(), _writeDefinedNameForPrintTitles(), and _writeNamedRanges().

Referenced by writeWorkbook().

{
// Write defined names
$objWriter->startElement('definedNames');
// Named ranges
if (count($pPHPExcel->getNamedRanges()) > 0) {
// Named ranges
$this->_writeNamedRanges($objWriter, $pPHPExcel);
}
// Other defined names
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
// definedName for autoFilter
$this->_writeDefinedNameForAutofilter($objWriter, $pPHPExcel->getSheet($i), $i);
// definedName for Print_Titles
$this->_writeDefinedNameForPrintTitles($objWriter, $pPHPExcel->getSheet($i), $i);
// definedName for Print_Area
$this->_writeDefinedNameForPrintArea($objWriter, $pPHPExcel->getSheet($i), $i);
}
$objWriter->endElement();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeFileVersion ( PHPExcel_Shared_XMLWriter  $objWriter = null)
private

Write file version.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
Exceptions
Exception

Definition at line 99 of file Workbook.php.

Referenced by writeWorkbook().

{
$objWriter->startElement('fileVersion');
$objWriter->writeAttribute('appName', 'xl');
$objWriter->writeAttribute('lastEdited', '4');
$objWriter->writeAttribute('lowestEdited', '4');
$objWriter->writeAttribute('rupBuild', '4505');
$objWriter->endElement();
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeNamedRanges ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel  $pPHPExcel 
)
private

Write named ranges.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel$pPHPExcel
Exceptions
Exception

Definition at line 296 of file Workbook.php.

References _writeDefinedNameForNamedRange(), and PHPExcel\getNamedRanges().

Referenced by _writeDefinedNames().

{
// Loop named ranges
$namedRanges = $pPHPExcel->getNamedRanges();
foreach ($namedRanges as $namedRange) {
$this->_writeDefinedNameForNamedRange($objWriter, $namedRange);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeSheet ( PHPExcel_Shared_XMLWriter  $objWriter = null,
  $pSheetname = '',
  $pSheetId = 1,
  $pRelId = 1,
  $sheetState = 'visible' 
)
private

Write sheet.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
string$pSheetnameSheet name
int$pSheetIdSheet id
int$pRelIdRelationship ID
string$sheetStateSheet state (visible, hidden, veryHidden)
Exceptions
Exception

Definition at line 238 of file Workbook.php.

Referenced by _writeSheets().

{
if ($pSheetname != '') {
// Write sheet
$objWriter->startElement('sheet');
$objWriter->writeAttribute('name', $pSheetname);
$objWriter->writeAttribute('sheetId', $pSheetId);
if ($sheetState != 'visible' && $sheetState != '') {
$objWriter->writeAttribute('state', $sheetState);
}
$objWriter->writeAttribute('r:id', 'rId' . $pRelId);
$objWriter->endElement();
} else {
throw new Exception("Invalid parameters passed.");
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeSheets ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel  $pPHPExcel = null 
)
private

Write sheets.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel$pPHPExcel
Exceptions
Exception

Definition at line 209 of file Workbook.php.

References _writeSheet().

Referenced by writeWorkbook().

{
// Write sheets
$objWriter->startElement('sheets');
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
// sheet
$this->_writeSheet(
$objWriter,
$pPHPExcel->getSheet($i)->getTitle(),
($i + 1),
($i + 1 + 3),
$pPHPExcel->getSheet($i)->getSheetState()
);
}
$objWriter->endElement();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeWorkbookPr ( PHPExcel_Shared_XMLWriter  $objWriter = null)
private

Write WorkbookPr.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
Exceptions
Exception

Definition at line 115 of file Workbook.php.

References PHPExcel_Shared_Date\CALENDAR_MAC_1904, and PHPExcel_Shared_Date\getExcelCalendar().

Referenced by writeWorkbook().

{
$objWriter->startElement('workbookPr');
$objWriter->writeAttribute('date1904', '1');
}
$objWriter->writeAttribute('codeName', 'ThisWorkbook');
$objWriter->endElement();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::_writeWorkbookProtection ( PHPExcel_Shared_XMLWriter  $objWriter = null,
PHPExcel  $pPHPExcel = null 
)
private

Write WorkbookProtection.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
PHPExcel$pPHPExcel
Exceptions
Exception

Definition at line 165 of file Workbook.php.

Referenced by writeWorkbook().

{
if ($pPHPExcel->getSecurity()->isSecurityEnabled()) {
$objWriter->startElement('workbookProtection');
$objWriter->writeAttribute('lockRevision', ($pPHPExcel->getSecurity()->getLockRevision() ? 'true' : 'false'));
$objWriter->writeAttribute('lockStructure', ($pPHPExcel->getSecurity()->getLockStructure() ? 'true' : 'false'));
$objWriter->writeAttribute('lockWindows', ($pPHPExcel->getSecurity()->getLockWindows() ? 'true' : 'false'));
if ($pPHPExcel->getSecurity()->getRevisionsPassword() != '') {
$objWriter->writeAttribute('revisionsPassword', $pPHPExcel->getSecurity()->getRevisionsPassword());
}
if ($pPHPExcel->getSecurity()->getWorkbookPassword() != '') {
$objWriter->writeAttribute('workbookPassword', $pPHPExcel->getSecurity()->getWorkbookPassword());
}
$objWriter->endElement();
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Workbook::writeWorkbook ( PHPExcel  $pPHPExcel = null)

Write workbook to XML format.

Parameters
PHPExcel$pPHPExcel
Returns
string XML Output
Exceptions
Exception

Definition at line 45 of file Workbook.php.

References _writeBookViews(), _writeCalcPr(), _writeDefinedNames(), _writeFileVersion(), _writeSheets(), _writeWorkbookPr(), _writeWorkbookProtection(), PHPExcel_Writer_Excel2007_WriterPart\getParentWriter(), PHPExcel_Shared_XMLWriter\STORAGE_DISK, and PHPExcel_Shared_XMLWriter\STORAGE_MEMORY.

{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
}
// XML header
$objWriter->startDocument('1.0','UTF-8','yes');
// workbook
$objWriter->startElement('workbook');
$objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
$objWriter->writeAttribute('xmlns:r', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
// fileVersion
$this->_writeFileVersion($objWriter);
// workbookPr
$this->_writeWorkbookPr($objWriter);
// workbookProtection
$this->_writeWorkbookProtection($objWriter, $pPHPExcel);
// bookViews
if ($this->getParentWriter()->getOffice2003Compatibility() === false) {
$this->_writeBookViews($objWriter, $pPHPExcel);
}
// sheets
$this->_writeSheets($objWriter, $pPHPExcel);
// definedNames
$this->_writeDefinedNames($objWriter, $pPHPExcel);
// calcPr
$this->_writeCalcPr($objWriter);
$objWriter->endElement();
// Return
return $objWriter->getData();
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: