PSR-2 : Fixes

This commit is contained in:
Progi1984 2015-05-13 13:15:55 +02:00
parent 2881bca443
commit 7d086fdbee
13 changed files with 1214 additions and 1237 deletions

View File

@ -59,50 +59,50 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
if (!empty($customPropertyList)) {
// Relationship docProps/app.xml
$this->_writeRelationship(
$objWriter,
4,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
'docProps/custom.xml'
);
}
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
if (!empty($customPropertyList)) {
// Relationship docProps/app.xml
$this->_writeRelationship(
$objWriter,
3,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
'docProps/app.xml'
4,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties',
'docProps/custom.xml'
);
// Relationship docProps/core.xml
$this->_writeRelationship(
$objWriter,
2,
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
'docProps/core.xml'
);
}
// Relationship xl/workbook.xml
$this->_writeRelationship(
// Relationship docProps/app.xml
$this->_writeRelationship(
$objWriter,
3,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
'docProps/app.xml'
);
// Relationship docProps/core.xml
$this->_writeRelationship(
$objWriter,
2,
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
'docProps/core.xml'
);
// Relationship xl/workbook.xml
$this->_writeRelationship(
$objWriter,
1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
'xl/workbook.xml'
);
// a custom UI in workbook ?
if ($pPHPExcel->hasRibbon()) {
$this->_writeRelationShip(
$objWriter,
1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
'xl/workbook.xml'
5,
'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility',
$pPHPExcel->getRibbonXMLData('target')
);
// a custom UI in workbook ?
if ($pPHPExcel->hasRibbon()) {
$this->_writeRelationShip(
$objWriter,
5,
'http://schemas.microsoft.com/office/2006/relationships/ui/extensibility',
$pPHPExcel->getRibbonXMLData('target')
);
}
}
$objWriter->endElement();
@ -134,51 +134,51 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Relationship styles.xml
// Relationship styles.xml
$this->_writeRelationship(
$objWriter,
1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
'styles.xml'
);
// Relationship theme/theme1.xml
$this->_writeRelationship(
$objWriter,
2,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
'theme/theme1.xml'
);
// Relationship sharedStrings.xml
$this->_writeRelationship(
$objWriter,
3,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
'sharedStrings.xml'
);
// Relationships with sheets
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
$this->_writeRelationship(
$objWriter,
1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
'styles.xml'
($i + 1 + 3),
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
'worksheets/sheet' . ($i + 1) . '.xml'
);
// Relationship theme/theme1.xml
$this->_writeRelationship(
}
// Relationships for vbaProject if needed
// id : just after the last sheet
if ($pPHPExcel->hasMacros()) {
$this->_writeRelationShip(
$objWriter,
2,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
'theme/theme1.xml'
($i + 1 + 3),
'http://schemas.microsoft.com/office/2006/relationships/vbaProject',
'vbaProject.bin'
);
// Relationship sharedStrings.xml
$this->_writeRelationship(
$objWriter,
3,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
'sharedStrings.xml'
);
// Relationships with sheets
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
$this->_writeRelationship(
$objWriter,
($i + 1 + 3),
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
'worksheets/sheet' . ($i + 1) . '.xml'
);
}
// Relationships for vbaProject if needed
// id : just after the last sheet
if ($pPHPExcel->hasMacros()) {
$this->_writeRelationShip(
$objWriter,
($i + 1 + 3),
'http://schemas.microsoft.com/office/2006/relationships/vbaProject',
'vbaProject.bin'
);
++$i;//increment i if needed for an another relation
}
++$i;//increment i if needed for an another relation
}
$objWriter->endElement();
@ -199,7 +199,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = FALSE)
public function writeWorksheetRelationships(PHPExcel_Worksheet $pWorksheet = null, $pWorksheetId = 1, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
@ -216,24 +216,24 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Write drawing relationships?
$d = 0;
if ($includeCharts) {
$charts = $pWorksheet->getChartCollection();
} else {
$charts = array();
}
if (($pWorksheet->getDrawingCollection()->count() > 0) ||
(count($charts) > 0)) {
$this->_writeRelationship(
$objWriter,
++$d,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
'../drawings/drawing' . $pWorksheetId . '.xml'
);
}
// Write drawing relationships?
$d = 0;
if ($includeCharts) {
$charts = $pWorksheet->getChartCollection();
} else {
$charts = array();
}
if (($pWorksheet->getDrawingCollection()->count() > 0) ||
(count($charts) > 0)) {
$this->_writeRelationship(
$objWriter,
++$d,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
'../drawings/drawing' . $pWorksheetId . '.xml'
);
}
// Write chart relationships?
// Write chart relationships?
// $chartCount = 0;
// $charts = $pWorksheet->getChartCollection();
// echo 'Chart Rels: ' , count($charts) , '<br />';
@ -248,50 +248,50 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
// }
// }
//
// Write hyperlink relationships?
$i = 1;
foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {
if (!$hyperlink->isInternal()) {
$this->_writeRelationship(
$objWriter,
'_hyperlink_' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
$hyperlink->getUrl(),
'External'
);
++$i;
}
}
// Write comments relationship?
$i = 1;
if (count($pWorksheet->getComments()) > 0) {
// Write hyperlink relationships?
$i = 1;
foreach ($pWorksheet->getHyperlinkCollection() as $hyperlink) {
if (!$hyperlink->isInternal()) {
$this->_writeRelationship(
$objWriter,
'_comments_vml' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
'../drawings/vmlDrawing' . $pWorksheetId . '.vml'
'_hyperlink_' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
$hyperlink->getUrl(),
'External'
);
$this->_writeRelationship(
$objWriter,
'_comments' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
'../comments' . $pWorksheetId . '.xml'
);
++$i;
}
}
// Write header/footer relationship?
$i = 1;
if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
$this->_writeRelationship(
$objWriter,
'_headerfooter_vml' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
'../drawings/vmlDrawingHF' . $pWorksheetId . '.vml'
);
}
// Write comments relationship?
$i = 1;
if (count($pWorksheet->getComments()) > 0) {
$this->_writeRelationship(
$objWriter,
'_comments_vml' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
'../drawings/vmlDrawing' . $pWorksheetId . '.vml'
);
$this->_writeRelationship(
$objWriter,
'_comments' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
'../comments' . $pWorksheetId . '.xml'
);
}
// Write header/footer relationship?
$i = 1;
if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
$this->_writeRelationship(
$objWriter,
'_headerfooter_vml' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
'../drawings/vmlDrawingHF' . $pWorksheetId . '.vml'
);
}
$objWriter->endElement();
@ -308,7 +308,7 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
public function writeDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
@ -325,39 +325,39 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Loop through images and write relationships
$i = 1;
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
while ($iterator->valid()) {
if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing
|| $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) {
// Write relationship for image drawing
// Loop through images and write relationships
$i = 1;
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
while ($iterator->valid()) {
if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing
|| $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) {
// Write relationship for image drawing
$this->_writeRelationship(
$objWriter,
$i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
'../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename())
);
}
$iterator->next();
++$i;
}
if ($includeCharts) {
// Loop through charts and write relationships
$chartCount = $pWorksheet->getChartCount();
if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeRelationship(
$objWriter,
$i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
'../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename())
$i++,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
'../charts/chart' . ++$chartRef . '.xml'
);
}
$iterator->next();
++$i;
}
if ($includeCharts) {
// Loop through charts and write relationships
$chartCount = $pWorksheet->getChartCount();
if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeRelationship(
$objWriter,
$i++,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart',
'../charts/chart' . ++$chartRef . '.xml'
);
}
}
}
}
$objWriter->endElement();
@ -389,16 +389,16 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Loop through images and write relationships
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
// Write relationship for image drawing
$this->_writeRelationship(
$objWriter,
$key,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
'../media/' . $value->getIndexedFilename()
);
}
// Loop through images and write relationships
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
// Write relationship for image drawing
$this->_writeRelationship(
$objWriter,
$key,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
'../media/' . $value->getIndexedFilename()
);
}
$objWriter->endElement();
@ -421,12 +421,12 @@ class PHPExcel_Writer_Excel2007_Rels extends PHPExcel_Writer_Excel2007_WriterPar
if ($pType != '' && $pTarget != '') {
// Write relationship
$objWriter->startElement('Relationship');
$objWriter->writeAttribute('Id', 'rId' . $pId);
$objWriter->writeAttribute('Type', $pType);
$objWriter->writeAttribute('Target', $pTarget);
$objWriter->writeAttribute('Id', 'rId' . $pId);
$objWriter->writeAttribute('Type', $pType);
$objWriter->writeAttribute('Target', $pTarget);
if ($pTargetMode != '') {
$objWriter->writeAttribute('TargetMode', $pTargetMode);
$objWriter->writeAttribute('TargetMode', $pTargetMode);
}
$objWriter->endElement();

View File

@ -42,7 +42,8 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null) {
public function writeRibbonRelationships(PHPExcel $pPHPExcel = null)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -57,9 +58,9 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
// Relationships
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
$localRels=$pPHPExcel->getRibbonBinObjects('names');
$localRels = $pPHPExcel->getRibbonBinObjects('names');
if (is_array($localRels)) {
foreach ($localRels as $aId=>$aTarget) {
foreach ($localRels as $aId => $aTarget) {
$objWriter->startElement('Relationship');
$objWriter->writeAttribute('Id', $aId);
$objWriter->writeAttribute('Type', 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image');
@ -71,7 +72,5 @@ class PHPExcel_Writer_Excel2007_RelsRibbon extends PHPExcel_Writer_Excel2007_Wri
// Return
return $objWriter->getData();
}
}

View File

@ -42,7 +42,8 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeVBARelationships(PHPExcel $pPHPExcel = null) {
public function writeVBARelationships(PHPExcel $pPHPExcel = null)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -68,5 +69,4 @@ class PHPExcel_Writer_Excel2007_RelsVBA extends PHPExcel_Writer_Excel2007_Writer
return $objWriter->getData();
}
}

View File

@ -45,14 +45,14 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
*/
public function createStringTable($pSheet = null, $pExistingTable = null)
{
if ($pSheet !== NULL) {
if ($pSheet !== null) {
// Create string lookup table
$aStringTable = array();
$cellCollection = null;
$aFlippedStringTable = null; // For faster lookup
// Is an existing table given?
if (($pExistingTable !== NULL) && is_array($pExistingTable)) {
if (($pExistingTable !== null) && is_array($pExistingTable)) {
$aStringTable = $pExistingTable;
}
@ -64,14 +64,14 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$cell = $pSheet->getCell($cellID);
$cellValue = $cell->getValue();
if (!is_object($cellValue) &&
($cellValue !== NULL) &&
($cellValue !== null) &&
$cellValue !== '' &&
!isset($aFlippedStringTable[$cellValue]) &&
($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_STRING2 || $cell->getDataType() == PHPExcel_Cell_DataType::TYPE_NULL)) {
$aStringTable[] = $cellValue;
$aFlippedStringTable[$cellValue] = true;
} elseif ($cellValue instanceof PHPExcel_RichText &&
($cellValue !== NULL) &&
($cellValue !== null) &&
!isset($aFlippedStringTable[$cellValue->getHashCode()])) {
$aStringTable[] = $cellValue;
$aFlippedStringTable[$cellValue->getHashCode()] = true;
@ -94,7 +94,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
*/
public function writeStringTable($pStringTable = null)
{
if ($pStringTable !== NULL) {
if ($pStringTable !== null) {
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -111,25 +111,25 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
$objWriter->writeAttribute('uniqueCount', count($pStringTable));
// Loop through string table
foreach ($pStringTable as $textElement) {
$objWriter->startElement('si');
if (! $textElement instanceof PHPExcel_RichText) {
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $textElement );
$objWriter->startElement('t');
if ($textToWrite !== trim($textToWrite)) {
$objWriter->writeAttribute('xml:space', 'preserve');
}
$objWriter->writeRawData($textToWrite);
$objWriter->endElement();
} else if ($textElement instanceof PHPExcel_RichText) {
$this->writeRichText($objWriter, $textElement);
}
// Loop through string table
foreach ($pStringTable as $textElement) {
$objWriter->startElement('si');
if (! $textElement instanceof PHPExcel_RichText) {
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML($textElement);
$objWriter->startElement('t');
if ($textToWrite !== trim($textToWrite)) {
$objWriter->writeAttribute('xml:space', 'preserve');
}
$objWriter->writeRawData($textToWrite);
$objWriter->endElement();
} else if ($textElement instanceof PHPExcel_RichText) {
$this->writeRichText($objWriter, $textElement);
}
$objWriter->endElement();
}
$objWriter->endElement();
// Return
@ -147,76 +147,78 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
* @param string $prefix Optional Namespace prefix
* @throws PHPExcel_Writer_Exception
*/
public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix=NULL)
public function writeRichText(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_RichText $pRichText = null, $prefix = null)
{
if ($prefix !== NULL)
if ($prefix !== null) {
$prefix .= ':';
}
// Loop through rich text elements
$elements = $pRichText->getRichTextElements();
foreach ($elements as $element) {
// r
$objWriter->startElement($prefix.'r');
// rPr
if ($element instanceof PHPExcel_RichText_Run) {
// rPr
if ($element instanceof PHPExcel_RichText_Run) {
// rPr
$objWriter->startElement($prefix.'rPr');
$objWriter->startElement($prefix.'rPr');
// rFont
$objWriter->startElement($prefix.'rFont');
$objWriter->writeAttribute('val', $element->getFont()->getName());
$objWriter->endElement();
// rFont
$objWriter->startElement($prefix.'rFont');
$objWriter->writeAttribute('val', $element->getFont()->getName());
$objWriter->endElement();
// Bold
$objWriter->startElement($prefix.'b');
$objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false'));
$objWriter->endElement();
// Bold
$objWriter->startElement($prefix.'b');
$objWriter->writeAttribute('val', ($element->getFont()->getBold() ? 'true' : 'false'));
$objWriter->endElement();
// Italic
$objWriter->startElement($prefix.'i');
$objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false'));
$objWriter->endElement();
// Superscript / subscript
if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
$objWriter->startElement($prefix.'vertAlign');
if ($element->getFont()->getSuperScript()) {
$objWriter->writeAttribute('val', 'superscript');
} else if ($element->getFont()->getSubScript()) {
$objWriter->writeAttribute('val', 'subscript');
}
$objWriter->endElement();
}
// Strikethrough
$objWriter->startElement($prefix.'strike');
$objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false'));
$objWriter->endElement();
// Color
$objWriter->startElement($prefix.'color');
$objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
$objWriter->endElement();
// Size
$objWriter->startElement($prefix.'sz');
$objWriter->writeAttribute('val', $element->getFont()->getSize());
$objWriter->endElement();
// Underline
$objWriter->startElement($prefix.'u');
$objWriter->writeAttribute('val', $element->getFont()->getUnderline());
$objWriter->endElement();
// Italic
$objWriter->startElement($prefix.'i');
$objWriter->writeAttribute('val', ($element->getFont()->getItalic() ? 'true' : 'false'));
$objWriter->endElement();
// Superscript / subscript
if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
$objWriter->startElement($prefix.'vertAlign');
if ($element->getFont()->getSuperScript()) {
$objWriter->writeAttribute('val', 'superscript');
} else if ($element->getFont()->getSubScript()) {
$objWriter->writeAttribute('val', 'subscript');
}
$objWriter->endElement();
}
// t
$objWriter->startElement($prefix.'t');
$objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
// Strikethrough
$objWriter->startElement($prefix.'strike');
$objWriter->writeAttribute('val', ($element->getFont()->getStrikethrough() ? 'true' : 'false'));
$objWriter->endElement();
// Color
$objWriter->startElement($prefix.'color');
$objWriter->writeAttribute('rgb', $element->getFont()->getColor()->getARGB());
$objWriter->endElement();
// Size
$objWriter->startElement($prefix.'sz');
$objWriter->writeAttribute('val', $element->getFont()->getSize());
$objWriter->endElement();
// Underline
$objWriter->startElement($prefix.'u');
$objWriter->writeAttribute('val', $element->getFont()->getUnderline());
$objWriter->endElement();
$objWriter->endElement();
}
// t
$objWriter->startElement($prefix.'t');
$objWriter->writeAttribute('xml:space', 'preserve');
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
$objWriter->endElement();
$objWriter->endElement();
}
}
@ -229,7 +231,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
* @param string $prefix Optional Namespace prefix
* @throws PHPExcel_Writer_Exception
*/
public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix=NULL)
public function writeRichTextForCharts(PHPExcel_Shared_XMLWriter $objWriter = null, $pRichText = null, $prefix = null)
{
if (!$pRichText instanceof PHPExcel_RichText) {
$textRun = $pRichText;
@ -237,41 +239,43 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
$pRichText->createTextRun($textRun);
}
if ($prefix !== NULL)
if ($prefix !== null) {
$prefix .= ':';
}
// Loop through rich text elements
$elements = $pRichText->getRichTextElements();
foreach ($elements as $element) {
// r
$objWriter->startElement($prefix.'r');
// rPr
$objWriter->startElement($prefix.'rPr');
// rPr
$objWriter->startElement($prefix.'rPr');
// Bold
$objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0));
// Italic
$objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0));
// Underline
$underlineType = $element->getFont()->getUnderline();
switch ($underlineType) {
case 'single' :
$underlineType = 'sng';
break;
case 'double' :
$underlineType = 'dbl';
break;
}
$objWriter->writeAttribute('u', $underlineType);
// Strikethrough
$objWriter->writeAttribute('strike', ($element->getFont()->getStrikethrough() ? 'sngStrike' : 'noStrike'));
// Bold
$objWriter->writeAttribute('b', ($element->getFont()->getBold() ? 1 : 0));
// Italic
$objWriter->writeAttribute('i', ($element->getFont()->getItalic() ? 1 : 0));
// Underline
$underlineType = $element->getFont()->getUnderline();
switch ($underlineType) {
case 'single' :
$underlineType = 'sng';
break;
case 'double' :
$underlineType = 'dbl';
break;
}
$objWriter->writeAttribute('u', $underlineType);
// Strikethrough
$objWriter->writeAttribute('strike', ($element->getFont()->getStrikethrough() ? 'sngStrike' : 'noStrike'));
// rFont
$objWriter->startElement($prefix.'latin');
$objWriter->writeAttribute('typeface', $element->getFont()->getName());
$objWriter->endElement();
// rFont
$objWriter->startElement($prefix.'latin');
$objWriter->writeAttribute('typeface', $element->getFont()->getName());
$objWriter->endElement();
// Superscript / subscript
// Superscript / subscript
// if ($element->getFont()->getSuperScript() || $element->getFont()->getSubScript()) {
// $objWriter->startElement($prefix.'vertAlign');
// if ($element->getFont()->getSuperScript()) {
@ -282,13 +286,13 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
// $objWriter->endElement();
// }
//
$objWriter->endElement();
$objWriter->endElement();
// t
$objWriter->startElement($prefix.'t');
// t
$objWriter->startElement($prefix.'t');
// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
$objWriter->endElement();
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
$objWriter->endElement();
$objWriter->endElement();
}

View File

@ -402,7 +402,7 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
}
if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164) );
$objWriter->writeAttribute('numFmtId', (int)($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164));
} else {
$objWriter->writeAttribute('numFmtId', (int)$pStyle->getNumberFormat()->getBuiltInFormatCode());
}
@ -508,14 +508,14 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
$objWriter->startElement('protection');
if (($pStyle->getProtection()->getLocked() !== null) &&
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
}
if (($pStyle->getProtection()->getHidden() !== null) &&
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
}
if (($pStyle->getProtection()->getLocked() !== null) &&
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
}
if (($pStyle->getProtection()->getHidden() !== null) &&
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
}
$objWriter->endElement();
}
}

File diff suppressed because it is too large Load Diff

View File

@ -362,7 +362,7 @@ class PHPExcel_Writer_Excel2007_Workbook extends PHPExcel_Writer_Excel2007_Write
$range = PHPExcel_Cell::splitRange($autoFilterRange);
$range = $range[0];
// Strip any worksheet ref so we can make the cell ref absolute
if (strpos($range[0],'!') !== false) {
if (strpos($range[0], '!') !== false) {
list($ws, $range[0]) = explode('!', $range[0]);
}

View File

@ -44,7 +44,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = FALSE)
public function writeWorksheet($pSheet = null, $pStringTable = null, $includeCharts = false)
{
if (!is_null($pSheet)) {
// Create XML writer
@ -152,33 +152,33 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if ($pSheet->hasCodeName()==false) {
$pSheet->setCodeName($pSheet->getTitle());
}
$objWriter->writeAttribute('codeName', $pSheet->getCodeName());
$objWriter->writeAttribute('codeName', $pSheet->getCodeName());
}
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
if (!empty($autoFilterRange)) {
$objWriter->writeAttribute('filterMode', 1);
$pSheet->getAutoFilter()->showHideRows();
}
$autoFilterRange = $pSheet->getAutoFilter()->getRange();
if (!empty($autoFilterRange)) {
$objWriter->writeAttribute('filterMode', 1);
$pSheet->getAutoFilter()->showHideRows();
}
// tabColor
if ($pSheet->isTabColorSet()) {
$objWriter->startElement('tabColor');
$objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB());
$objWriter->endElement();
}
// outlinePr
$objWriter->startElement('outlinePr');
$objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0'));
$objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0'));
// tabColor
if ($pSheet->isTabColorSet()) {
$objWriter->startElement('tabColor');
$objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB());
$objWriter->endElement();
}
// pageSetUpPr
if ($pSheet->getPageSetup()->getFitToPage()) {
$objWriter->startElement('pageSetUpPr');
$objWriter->writeAttribute('fitToPage', '1');
$objWriter->endElement();
}
// outlinePr
$objWriter->startElement('outlinePr');
$objWriter->writeAttribute('summaryBelow', ($pSheet->getShowSummaryBelow() ? '1' : '0'));
$objWriter->writeAttribute('summaryRight', ($pSheet->getShowSummaryRight() ? '1' : '0'));
$objWriter->endElement();
// pageSetUpPr
if ($pSheet->getPageSetup()->getFitToPage()) {
$objWriter->startElement('pageSetUpPr');
$objWriter->writeAttribute('fitToPage', '1');
$objWriter->endElement();
}
$objWriter->endElement();
}
@ -205,28 +205,28 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception
*/
private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = NULL, PHPExcel_Worksheet $pSheet = NULL)
private function _writeSheetViews(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
{
// sheetViews
$objWriter->startElement('sheetViews');
// Sheet selected?
$sheetSelected = false;
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex())
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) {
$sheetSelected = true;
}
// sheetView
$objWriter->startElement('sheetView');
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
$objWriter->writeAttribute('workbookViewId', '0');
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
$objWriter->writeAttribute('workbookViewId', '0');
// Zoom scales
if ($pSheet->getSheetView()->getZoomScale() != 100) {
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
}
if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
}
// View Layout Type
@ -236,9 +236,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Gridlines
if ($pSheet->getShowGridlines()) {
$objWriter->writeAttribute('showGridLines', 'true');
$objWriter->writeAttribute('showGridLines', 'true');
} else {
$objWriter->writeAttribute('showGridLines', 'false');
$objWriter->writeAttribute('showGridLines', 'false');
}
// Row and column headers
@ -250,7 +250,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Right-to-left
if ($pSheet->getRightToLeft()) {
$objWriter->writeAttribute('rightToLeft', 'true');
$objWriter->writeAttribute('rightToLeft', 'true');
}
$activeCell = $pSheet->getActiveCell();
@ -270,20 +270,24 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$pane = 'topRight';
$objWriter->startElement('pane');
if ($xSplit > 1)
$objWriter->writeAttribute('xSplit', $xSplit - 1);
$objWriter->writeAttribute('xSplit', $xSplit - 1);
if ($ySplit > 1) {
$objWriter->writeAttribute('ySplit', $ySplit - 1);
$objWriter->writeAttribute('ySplit', $ySplit - 1);
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
}
$objWriter->writeAttribute('topLeftCell', $topLeftCell);
$objWriter->writeAttribute('activePane', $pane);
$objWriter->writeAttribute('state', 'frozen');
$objWriter->writeAttribute('topLeftCell', $topLeftCell);
$objWriter->writeAttribute('activePane', $pane);
$objWriter->writeAttribute('state', 'frozen');
$objWriter->endElement();
if (($xSplit > 1) && ($ySplit > 1)) {
// Write additional selections if more than two panes (ie both an X and a Y split)
$objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'topRight'); $objWriter->endElement();
$objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'bottomLeft'); $objWriter->endElement();
$objWriter->startElement('selection');
$objWriter->writeAttribute('pane', 'topRight');
$objWriter->endElement();
$objWriter->startElement('selection');
$objWriter->writeAttribute('pane', 'bottomLeft');
$objWriter->endElement();
}
}
@ -317,42 +321,42 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// sheetFormatPr
$objWriter->startElement('sheetFormatPr');
// Default row height
if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
$objWriter->writeAttribute('customHeight', 'true');
$objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
} else {
$objWriter->writeAttribute('defaultRowHeight', '14.4');
}
// Default row height
if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
$objWriter->writeAttribute('customHeight', 'true');
$objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
} else {
$objWriter->writeAttribute('defaultRowHeight', '14.4');
}
// Set Zero Height row
if ((string)$pSheet->getDefaultRowDimension()->getZeroHeight() == '1' ||
strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true' ) {
$objWriter->writeAttribute('zeroHeight', '1');
}
// Set Zero Height row
if ((string)$pSheet->getDefaultRowDimension()->getZeroHeight() == '1' ||
strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true') {
$objWriter->writeAttribute('zeroHeight', '1');
}
// Default column width
if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
$objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
}
// Default column width
if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
$objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
}
// Outline level - row
$outlineLevelRow = 0;
foreach ($pSheet->getRowDimensions() as $dimension) {
if ($dimension->getOutlineLevel() > $outlineLevelRow) {
$outlineLevelRow = $dimension->getOutlineLevel();
}
// Outline level - row
$outlineLevelRow = 0;
foreach ($pSheet->getRowDimensions() as $dimension) {
if ($dimension->getOutlineLevel() > $outlineLevelRow) {
$outlineLevelRow = $dimension->getOutlineLevel();
}
$objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow);
}
$objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow);
// Outline level - column
$outlineLevelCol = 0;
foreach ($pSheet->getColumnDimensions() as $dimension) {
if ($dimension->getOutlineLevel() > $outlineLevelCol) {
$outlineLevelCol = $dimension->getOutlineLevel();
}
// Outline level - column
$outlineLevelCol = 0;
foreach ($pSheet->getColumnDimensions() as $dimension) {
if ($dimension->getOutlineLevel() > $outlineLevelCol) {
$outlineLevelCol = $dimension->getOutlineLevel();
}
$objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol);
}
$objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol);
$objWriter->endElement();
}
@ -360,8 +364,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
/**
* Write Cols
*
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @param PHPExcel_Worksheet $pSheet Worksheet
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @param PHPExcel_Worksheet $pSheet Worksheet
* @throws PHPExcel_Writer_Exception
*/
private function _writeCols(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null)
@ -370,54 +374,54 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if (count($pSheet->getColumnDimensions()) > 0) {
$objWriter->startElement('cols');
$pSheet->calculateColumnWidths();
$pSheet->calculateColumnWidths();
// Loop through column dimensions
foreach ($pSheet->getColumnDimensions() as $colDimension) {
// col
$objWriter->startElement('col');
$objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
$objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
// Loop through column dimensions
foreach ($pSheet->getColumnDimensions() as $colDimension) {
// col
$objWriter->startElement('col');
$objWriter->writeAttribute('min', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
$objWriter->writeAttribute('max', PHPExcel_Cell::columnIndexFromString($colDimension->getColumnIndex()));
if ($colDimension->getWidth() < 0) {
// No width set, apply default of 10
$objWriter->writeAttribute('width', '9.10');
} else {
// Width set
$objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth()));
}
// Column visibility
if ($colDimension->getVisible() == false) {
$objWriter->writeAttribute('hidden', 'true');
}
// Auto size?
if ($colDimension->getAutoSize()) {
$objWriter->writeAttribute('bestFit', 'true');
}
// Custom width?
if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) {
$objWriter->writeAttribute('customWidth', 'true');
}
// Collapsed
if ($colDimension->getCollapsed() == true) {
$objWriter->writeAttribute('collapsed', 'true');
}
// Outline level
if ($colDimension->getOutlineLevel() > 0) {
$objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel());
}
// Style
$objWriter->writeAttribute('style', $colDimension->getXfIndex());
$objWriter->endElement();
if ($colDimension->getWidth() < 0) {
// No width set, apply default of 10
$objWriter->writeAttribute('width', '9.10');
} else {
// Width set
$objWriter->writeAttribute('width', PHPExcel_Shared_String::FormatNumber($colDimension->getWidth()));
}
// Column visibility
if ($colDimension->getVisible() == false) {
$objWriter->writeAttribute('hidden', 'true');
}
// Auto size?
if ($colDimension->getAutoSize()) {
$objWriter->writeAttribute('bestFit', 'true');
}
// Custom width?
if ($colDimension->getWidth() != $pSheet->getDefaultColumnDimension()->getWidth()) {
$objWriter->writeAttribute('customWidth', 'true');
}
// Collapsed
if ($colDimension->getCollapsed() == true) {
$objWriter->writeAttribute('collapsed', 'true');
}
// Outline level
if ($colDimension->getOutlineLevel() > 0) {
$objWriter->writeAttribute('outlineLevel', $colDimension->getOutlineLevel());
}
// Style
$objWriter->writeAttribute('style', $colDimension->getXfIndex());
$objWriter->endElement();
}
$objWriter->endElement();
}
}
@ -435,25 +439,25 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->startElement('sheetProtection');
if ($pSheet->getProtection()->getPassword() != '') {
$objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword());
$objWriter->writeAttribute('password', $pSheet->getProtection()->getPassword());
}
$objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false'));
$objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false'));
$objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false'));
$objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false'));
$objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false'));
$objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false'));
$objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false'));
$objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false'));
$objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false'));
$objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false'));
$objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false'));
$objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false'));
$objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false'));
$objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false'));
$objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false'));
$objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false'));
$objWriter->writeAttribute('sheet', ($pSheet->getProtection()->getSheet() ? 'true' : 'false'));
$objWriter->writeAttribute('objects', ($pSheet->getProtection()->getObjects() ? 'true' : 'false'));
$objWriter->writeAttribute('scenarios', ($pSheet->getProtection()->getScenarios() ? 'true' : 'false'));
$objWriter->writeAttribute('formatCells', ($pSheet->getProtection()->getFormatCells() ? 'true' : 'false'));
$objWriter->writeAttribute('formatColumns', ($pSheet->getProtection()->getFormatColumns() ? 'true' : 'false'));
$objWriter->writeAttribute('formatRows', ($pSheet->getProtection()->getFormatRows() ? 'true' : 'false'));
$objWriter->writeAttribute('insertColumns', ($pSheet->getProtection()->getInsertColumns() ? 'true' : 'false'));
$objWriter->writeAttribute('insertRows', ($pSheet->getProtection()->getInsertRows() ? 'true' : 'false'));
$objWriter->writeAttribute('insertHyperlinks', ($pSheet->getProtection()->getInsertHyperlinks() ? 'true' : 'false'));
$objWriter->writeAttribute('deleteColumns', ($pSheet->getProtection()->getDeleteColumns() ? 'true' : 'false'));
$objWriter->writeAttribute('deleteRows', ($pSheet->getProtection()->getDeleteRows() ? 'true' : 'false'));
$objWriter->writeAttribute('selectLockedCells', ($pSheet->getProtection()->getSelectLockedCells() ? 'true' : 'false'));
$objWriter->writeAttribute('sort', ($pSheet->getProtection()->getSort() ? 'true' : 'false'));
$objWriter->writeAttribute('autoFilter', ($pSheet->getProtection()->getAutoFilter() ? 'true' : 'false'));
$objWriter->writeAttribute('pivotTables', ($pSheet->getProtection()->getPivotTables() ? 'true' : 'false'));
$objWriter->writeAttribute('selectUnlockedCells', ($pSheet->getProtection()->getSelectUnlockedCells() ? 'true' : 'false'));
$objWriter->endElement();
}
@ -473,54 +477,54 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
foreach ($pSheet->getConditionalStylesCollection() as $cellCoordinate => $conditionalStyles) {
foreach ($conditionalStyles as $conditional) {
// WHY was this again?
// if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ) == '') {
// if ($this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()) == '') {
// continue;
// }
if ($conditional->getConditionType() != PHPExcel_Style_Conditional::CONDITION_NONE) {
// conditionalFormatting
$objWriter->startElement('conditionalFormatting');
$objWriter->writeAttribute('sqref', $cellCoordinate);
$objWriter->writeAttribute('sqref', $cellCoordinate);
// cfRule
$objWriter->startElement('cfRule');
$objWriter->writeAttribute('type', $conditional->getConditionType());
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ));
$objWriter->writeAttribute('priority', $id++);
$objWriter->writeAttribute('type', $conditional->getConditionType());
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
$objWriter->writeAttribute('priority', $id++);
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
||
$conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
}
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& !is_null($conditional->getText())) {
$objWriter->writeAttribute('text', $conditional->getText());
$objWriter->writeAttribute('text', $conditional->getText());
}
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
&& !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
foreach ($conditional->getConditions() as $formula) {
// Formula
$objWriter->writeElement('formula', $formula);
$objWriter->writeElement('formula', $formula);
}
}
@ -564,10 +568,10 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('operator', $dv->getOperator());
}
$objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0'));
$objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0'));
$objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0'));
$objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0'));
$objWriter->writeAttribute('allowBlank', ($dv->getAllowBlank() ? '1' : '0'));
$objWriter->writeAttribute('showDropDown', (!$dv->getShowDropDown() ? '1' : '0'));
$objWriter->writeAttribute('showInputMessage', ($dv->getShowInputMessage() ? '1' : '0'));
$objWriter->writeAttribute('showErrorMessage', ($dv->getShowErrorMessage() ? '1' : '0'));
if ($dv->getErrorTitle() !== '') {
$objWriter->writeAttribute('errorTitle', $dv->getErrorTitle());
@ -622,10 +626,10 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('ref', $coordinate);
if (!$hyperlink->isInternal()) {
$objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId);
$objWriter->writeAttribute('r:id', 'rId_hyperlink_' . $relationId);
++$relationId;
} else {
$objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl()));
$objWriter->writeAttribute('location', str_replace('sheet://', '', $hyperlink->getUrl()));
}
if ($hyperlink->getTooltip() != '') {
@ -656,8 +660,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
foreach ($pSheet->getProtectedCells() as $protectedCell => $passwordHash) {
// protectedRange
$objWriter->startElement('protectedRange');
$objWriter->writeAttribute('name', 'p' . md5($protectedCell));
$objWriter->writeAttribute('sqref', $protectedCell);
$objWriter->writeAttribute('name', 'p' . md5($protectedCell));
$objWriter->writeAttribute('sqref', $protectedCell);
if (!empty($passwordHash)) {
$objWriter->writeAttribute('password', $passwordHash);
}
@ -705,8 +709,8 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// printOptions
$objWriter->startElement('printOptions');
$objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false'));
$objWriter->writeAttribute('gridLinesSet', 'true');
$objWriter->writeAttribute('gridLines', ($pSheet->getPrintGridlines() ? 'true': 'false'));
$objWriter->writeAttribute('gridLinesSet', 'true');
if ($pSheet->getPageSetup()->getHorizontalCentered()) {
$objWriter->writeAttribute('horizontalCentered', 'true');
@ -730,12 +734,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
{
// pageMargins
$objWriter->startElement('pageMargins');
$objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()));
$objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()));
$objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()));
$objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()));
$objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader()));
$objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter()));
$objWriter->writeAttribute('left', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getLeft()));
$objWriter->writeAttribute('right', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getRight()));
$objWriter->writeAttribute('top', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getTop()));
$objWriter->writeAttribute('bottom', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getBottom()));
$objWriter->writeAttribute('header', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getHeader()));
$objWriter->writeAttribute('footer', PHPExcel_Shared_String::FormatNumber($pSheet->getPageMargins()->getFooter()));
$objWriter->endElement();
}
@ -762,7 +766,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
}
$range = implode(':', $range);
$objWriter->writeAttribute('ref', str_replace('$','', $range));
$objWriter->writeAttribute('ref', str_replace('$','', $range));
$columns = $pSheet->getAutoFilter()->getColumns();
if (count($columns > 0)) {
@ -770,11 +774,11 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$rules = $column->getRules();
if (count($rules > 0)) {
$objWriter->startElement('filterColumn');
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
$objWriter->startElement( $column->getFilterType());
$objWriter->startElement($column->getFilterType());
if ($column->getJoin() == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND) {
$objWriter->writeAttribute('and', 1);
$objWriter->writeAttribute('and', 1);
}
foreach ($rules as $rule) {
@ -787,33 +791,33 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Dynamic Filter Rule
$objWriter->writeAttribute('type', $rule->getGrouping());
$val = $column->getAttribute('val');
if ($val !== NULL) {
if ($val !== null) {
$objWriter->writeAttribute('val', $val);
}
$maxVal = $column->getAttribute('maxVal');
if ($maxVal !== NULL) {
if ($maxVal !== null) {
$objWriter->writeAttribute('maxVal', $maxVal);
}
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER) {
// Top 10 Filter Rule
$objWriter->writeAttribute('val', $rule->getValue());
$objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
$objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
$objWriter->writeAttribute('val', $rule->getValue());
$objWriter->writeAttribute('percent', (($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT) ? '1' : '0'));
$objWriter->writeAttribute('top', (($rule->getGrouping() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) ? '1': '0'));
} else {
// Filter, DateGroupItem or CustomFilter
$objWriter->startElement($rule->getRuleType());
if ($rule->getOperator() !== PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) {
$objWriter->writeAttribute('operator', $rule->getOperator());
$objWriter->writeAttribute('operator', $rule->getOperator());
}
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
// Date Group filters
foreach ($rule->getValue() as $key => $value) {
if ($value > '') $objWriter->writeAttribute($key, $value);
if ($value > '') $objWriter->writeAttribute($key, $value);
}
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
} else {
$objWriter->writeAttribute('val', $rule->getValue());
$objWriter->writeAttribute('val', $rule->getValue());
}
$objWriter->endElement();
@ -842,24 +846,24 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
{
// pageSetup
$objWriter->startElement('pageSetup');
$objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize());
$objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation());
$objWriter->writeAttribute('paperSize', $pSheet->getPageSetup()->getPaperSize());
$objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation());
if (!is_null($pSheet->getPageSetup()->getScale())) {
$objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale());
$objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale());
}
if (!is_null($pSheet->getPageSetup()->getFitToHeight())) {
$objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight());
$objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight());
} else {
$objWriter->writeAttribute('fitToHeight', '0');
$objWriter->writeAttribute('fitToHeight', '0');
}
if (!is_null($pSheet->getPageSetup()->getFitToWidth())) {
$objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth());
$objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth());
} else {
$objWriter->writeAttribute('fitToWidth', '0');
$objWriter->writeAttribute('fitToWidth', '0');
}
if (!is_null($pSheet->getPageSetup()->getFirstPageNumber())) {
$objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
$objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
$objWriter->writeAttribute('useFirstPageNumber', '1');
}
@ -877,17 +881,17 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
{
// headerFooter
$objWriter->startElement('headerFooter');
$objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false'));
$objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false'));
$objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false'));
$objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false'));
$objWriter->writeAttribute('differentOddEven', ($pSheet->getHeaderFooter()->getDifferentOddEven() ? 'true' : 'false'));
$objWriter->writeAttribute('differentFirst', ($pSheet->getHeaderFooter()->getDifferentFirst() ? 'true' : 'false'));
$objWriter->writeAttribute('scaleWithDoc', ($pSheet->getHeaderFooter()->getScaleWithDocument() ? 'true' : 'false'));
$objWriter->writeAttribute('alignWithMargins', ($pSheet->getHeaderFooter()->getAlignWithMargins() ? 'true' : 'false'));
$objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader());
$objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter());
$objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader());
$objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter());
$objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader());
$objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter());
$objWriter->writeElement('oddHeader', $pSheet->getHeaderFooter()->getOddHeader());
$objWriter->writeElement('oddFooter', $pSheet->getHeaderFooter()->getOddFooter());
$objWriter->writeElement('evenHeader', $pSheet->getHeaderFooter()->getEvenHeader());
$objWriter->writeElement('evenFooter', $pSheet->getHeaderFooter()->getEvenFooter());
$objWriter->writeElement('firstHeader', $pSheet->getHeaderFooter()->getFirstHeader());
$objWriter->writeElement('firstFooter', $pSheet->getHeaderFooter()->getFirstFooter());
$objWriter->endElement();
}
@ -914,15 +918,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// rowBreaks
if (!empty($aRowBreaks)) {
$objWriter->startElement('rowBreaks');
$objWriter->writeAttribute('count', count($aRowBreaks));
$objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
$objWriter->writeAttribute('count', count($aRowBreaks));
$objWriter->writeAttribute('manualBreakCount', count($aRowBreaks));
foreach ($aRowBreaks as $cell) {
$coords = PHPExcel_Cell::coordinateFromString($cell);
$objWriter->startElement('brk');
$objWriter->writeAttribute('id', $coords[1]);
$objWriter->writeAttribute('man', '1');
$objWriter->writeAttribute('id', $coords[1]);
$objWriter->writeAttribute('man', '1');
$objWriter->endElement();
}
@ -932,15 +936,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Second, write column breaks
if (!empty($aColumnBreaks)) {
$objWriter->startElement('colBreaks');
$objWriter->writeAttribute('count', count($aColumnBreaks));
$objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
$objWriter->writeAttribute('count', count($aColumnBreaks));
$objWriter->writeAttribute('manualBreakCount', count($aColumnBreaks));
foreach ($aColumnBreaks as $cell) {
$coords = PHPExcel_Cell::coordinateFromString($cell);
$objWriter->startElement('brk');
$objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
$objWriter->writeAttribute('man', '1');
$objWriter->writeAttribute('id', PHPExcel_Cell::columnIndexFromString($coords[0]) - 1);
$objWriter->writeAttribute('man', '1');
$objWriter->endElement();
}
@ -965,77 +969,72 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// sheetData
$objWriter->startElement('sheetData');
// Get column count
$colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn());
// Get column count
$colCount = PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn());
// Highest row number
$highestRow = $pSheet->getHighestRow();
// Highest row number
$highestRow = $pSheet->getHighestRow();
// Loop through cells
$cellsByRow = array();
foreach ($pSheet->getCellCollection() as $cellID) {
$cellAddress = PHPExcel_Cell::coordinateFromString($cellID);
$cellsByRow[$cellAddress[1]][] = $cellID;
}
// Loop through cells
$cellsByRow = array();
foreach ($pSheet->getCellCollection() as $cellID) {
$cellAddress = PHPExcel_Cell::coordinateFromString($cellID);
$cellsByRow[$cellAddress[1]][] = $cellID;
}
$currentRow = 0;
while ($currentRow++ < $highestRow) {
// Get row dimension
$rowDimension = $pSheet->getRowDimension($currentRow);
$currentRow = 0;
while ($currentRow++ < $highestRow) {
// Get row dimension
$rowDimension = $pSheet->getRowDimension($currentRow);
// Write current row?
$writeCurrentRow = isset($cellsByRow[$currentRow]) ||
$rowDimension->getRowHeight() >= 0 ||
$rowDimension->getVisible() == false ||
$rowDimension->getCollapsed() == true ||
$rowDimension->getOutlineLevel() > 0 ||
$rowDimension->getXfIndex() !== null;
// Write current row?
$writeCurrentRow = isset($cellsByRow[$currentRow]) || $rowDimension->getRowHeight() >= 0 || $rowDimension->getVisible() == false || $rowDimension->getCollapsed() == true || $rowDimension->getOutlineLevel() > 0 || $rowDimension->getXfIndex() !== null;
if ($writeCurrentRow) {
// Start a new row
$objWriter->startElement('row');
$objWriter->writeAttribute('r', $currentRow);
$objWriter->writeAttribute('spans', '1:' . $colCount);
if ($writeCurrentRow) {
// Start a new row
$objWriter->startElement('row');
$objWriter->writeAttribute('r', $currentRow);
$objWriter->writeAttribute('spans', '1:' . $colCount);
// Row dimensions
if ($rowDimension->getRowHeight() >= 0) {
$objWriter->writeAttribute('customHeight', '1');
$objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight()));
}
// Row visibility
if ($rowDimension->getVisible() == false) {
$objWriter->writeAttribute('hidden', 'true');
}
// Collapsed
if ($rowDimension->getCollapsed() == true) {
$objWriter->writeAttribute('collapsed', 'true');
}
// Outline level
if ($rowDimension->getOutlineLevel() > 0) {
$objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel());
}
// Style
if ($rowDimension->getXfIndex() !== null) {
$objWriter->writeAttribute('s', $rowDimension->getXfIndex());
$objWriter->writeAttribute('customFormat', '1');
}
// Write cells
if (isset($cellsByRow[$currentRow])) {
foreach ($cellsByRow[$currentRow] as $cellAddress) {
// Write cell
$this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
}
}
// End row
$objWriter->endElement();
// Row dimensions
if ($rowDimension->getRowHeight() >= 0) {
$objWriter->writeAttribute('customHeight', '1');
$objWriter->writeAttribute('ht', PHPExcel_Shared_String::FormatNumber($rowDimension->getRowHeight()));
}
// Row visibility
if ($rowDimension->getVisible() == false) {
$objWriter->writeAttribute('hidden', 'true');
}
// Collapsed
if ($rowDimension->getCollapsed() == true) {
$objWriter->writeAttribute('collapsed', 'true');
}
// Outline level
if ($rowDimension->getOutlineLevel() > 0) {
$objWriter->writeAttribute('outlineLevel', $rowDimension->getOutlineLevel());
}
// Style
if ($rowDimension->getXfIndex() !== null) {
$objWriter->writeAttribute('s', $rowDimension->getXfIndex());
$objWriter->writeAttribute('customFormat', '1');
}
// Write cells
if (isset($cellsByRow[$currentRow])) {
foreach ($cellsByRow[$currentRow] as $cellAddress) {
// Write cell
$this->_writeCell($objWriter, $pSheet, $cellAddress, $pStringTable, $aFlippedStringTable);
}
}
// End row
$objWriter->endElement();
}
}
$objWriter->endElement();
} else {
@ -1095,7 +1094,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
switch (strtolower($mappedType)) {
case 'inlinestr': // Inline string
if (! $cellValue instanceof PHPExcel_RichText) {
$objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML( htmlspecialchars($cellValue) ) );
$objWriter->writeElement('t', PHPExcel_Shared_String::ControlCharacterPHP2OOXML(htmlspecialchars($cellValue)));
} else if ($cellValue instanceof PHPExcel_RichText) {
$objWriter->startElement('is');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $cellValue);
@ -1172,7 +1171,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
* @param boolean $includeCharts Flag indicating if we should include drawing details for charts
* @throws PHPExcel_Writer_Exception
*/
private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = FALSE)
private function _writeDrawings(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Worksheet $pSheet = null, $includeCharts = false)
{
$chartCount = ($includeCharts) ? $pSheet->getChartCollection()->count() : 0;
// If sheet contains drawings, add the relationships

View File

@ -467,7 +467,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
case 1: // GIF, not supported by BIFF8, we convert to PNG
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
ob_start();
imagepng(imagecreatefromgif ($filename));
imagepng(imagecreatefromgif($filename));
$blipData = ob_get_contents();
ob_end_clean();
break;

View File

@ -105,7 +105,8 @@ class PHPExcel_Writer_Excel5_Escher
// dgg data
$dggData =
pack('VVVV',
pack(
'VVVV',
$this->_object->getSpIdMax(), // maximum shape identifier increased by one
$this->_object->getCDgSaved() + 1, // number of file identifier clusters increased by one
$this->_object->getCSpSaved(),
@ -187,7 +188,7 @@ class PHPExcel_Writer_Excel5_Escher
$btMacOS = $this->_object->getBlipType();
$data .= pack('CC', $btWin32, $btMacOS);
$rgbUid = pack('VVVV', 0,0,0,0); // todo
$rgbUid = pack('VVVV', 0, 0, 0, 0); // todo
$data .= $rgbUid;
$tag = 0;
@ -226,7 +227,7 @@ class PHPExcel_Writer_Excel5_Escher
// initialize
$innerData = '';
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
$rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo
$innerData .= $rgbUid1;
$tag = 0xFF; // todo
@ -253,7 +254,7 @@ class PHPExcel_Writer_Excel5_Escher
// initialize
$innerData = '';
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
$rgbUid1 = pack('VVVV', 0, 0, 0, 0); // todo
$innerData .= $rgbUid1;
$tag = 0xFF; // todo
@ -387,7 +388,7 @@ class PHPExcel_Writer_Excel5_Escher
$header = pack('vvV', $recVerInstance, $recType, $length);
$data .= $header . pack('VVVV', 0,0,0,0);
$data .= $header . pack('VVVV', 0, 0, 0, 0);
}
$this->_spTypes[] = ($this->_object->getSpType());

View File

@ -1130,60 +1130,39 @@ class PHPExcel_Writer_Excel5_Parser
break;
default:
// if it's a reference A1 or $A$1 or $A1 or A$1
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.') and
($this->_lookahead != '!')) {
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.') and ($this->_lookahead != '!')) {
return $token;
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
return $token;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
return $token;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead) and
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
// if it's a range A1:A2 or $A$1:$A$2
return $token;
}
// if it's a range A1:A2 or $A$1:$A$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
return $token;
}
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead)) {
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
return $token;
}
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
!preg_match("/[0-9]/", $this->_lookahead)) {
} elseif (is_numeric($token) and (!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and ($this->_lookahead != '!') and ($this->_lookahead != ':')) {
// If it's a number (check that it's not a sheet name or range)
return $token;
}
// If it's a number (check that it's not a sheet name or range)
elseif (is_numeric($token) and
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
($this->_lookahead != '!') and ($this->_lookahead != ':')) {
} elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
// If it's a string (of maximum 255 characters)
return $token;
}
// If it's a string (of maximum 255 characters)
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
// If it's an error code
return $token;
}
// If it's an error code
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
// if it's a function call
return $token;
}
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
return $token;
}
// It's an argument of some description (e.g. a named range),
// precise nature yet to be determined
elseif (substr($token,-1) == ')') {
} elseif (substr($token, -1) == ')') {
// It's an argument of some description (e.g. a named range),
// precise nature yet to be determined
return $token;
}
return '';
@ -1266,7 +1245,10 @@ class PHPExcel_Writer_Excel5_Parser
// If it's a string return a string node
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
$tmp = str_replace('""', '"', $this->_current_token);
if (($tmp == '"') || ($tmp == '')) $tmp = '""'; // Trap for "" that has been used for an empty string
if (($tmp == '"') || ($tmp == '')) {
// Trap for "" that has been used for an empty string
$tmp = '""';
}
$result = $this->_createTree($tmp, '', '');
$this->_advance();
return $result;
@ -1375,38 +1357,33 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// if it's a reference
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token))
{
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
{
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
{
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// if it's a range A1:B2 or $A$1:$B$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token))
{
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) {
// must be an error?
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
{
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
@ -1414,8 +1391,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
{
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
@ -1423,8 +1399,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// If it's a number or a percent
elseif (is_numeric($this->_current_token))
{
elseif (is_numeric($this->_current_token)) {
if ($this->_lookahead == '%') {
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
@ -1435,8 +1410,7 @@ class PHPExcel_Writer_Excel5_Parser
return $result;
}
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token))
{
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
$result = $this->_func();
return $result;
}
@ -1462,13 +1436,10 @@ class PHPExcel_Writer_Excel5_Parser
while ($this->_current_token != ')') {
/**/
if ($num_args > 0) {
if ($this->_current_token == "," or
$this->_current_token == ";")
{
if ($this->_current_token == "," || $this->_current_token == ";") {
$this->_advance(); // eat the "," or ";"
} else {
throw new PHPExcel_Writer_Exception("Syntax error: comma expected in ".
"function $function, arg #{$num_args}");
throw new PHPExcel_Writer_Exception("Syntax error: comma expected in function $function, arg #{$num_args}");
}
$result2 = $this->_condition();
$result = $this->_createTree('arg', $result, $result2);
@ -1560,8 +1531,7 @@ class PHPExcel_Writer_Excel5_Parser
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
!is_numeric($tree['value']) and
!isset($this->ptg[$tree['value']]))
{
!isset($this->ptg[$tree['value']])) {
// left subtree for a function is always an array.
if ($tree['left'] != '') {
$left_tree = $this->toReversePolish($tree['left']);

View File

@ -845,7 +845,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
// option flags
$options = ($isHidden ? 0x21 : 0x00);
$extra = pack('Cvvvvv',
$extra = pack(
'Cvvvvv',
0x3B,
$sheetIndex - 1,
$rangeBounds[0][1] - 1,
@ -906,7 +907,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
$itabFirst = 0; // 1st displayed worksheet
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
$header = pack("vv", $record, $length);
$header = pack("vv", $record, $length);
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
$this->_append($header . $data);
}

View File

@ -1590,7 +1590,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// record data
$recordData = pack(
'vVVCVVvv',
'vVVCVVvv',
0x0867, // repeated record identifier
0x0000, // not used
0x0000, // not used
@ -2736,7 +2736,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
if ($spTypes[$i] == 0x00C9) {
// Add ftCmo (common object data) subobject
$objData .=
pack('vvvvvVVV',
pack(
'vvvvvVVV',
0x0015, // 0x0015 = ftCmo
0x0012, // length of ftCmo data
0x0014, // object type, 0x0014 = filter
@ -2756,7 +2757,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
} else {
// Add ftCmo (common object data) subobject
$objData .=
pack('vvvvvVVV',
pack(
'vvvvvVVV',
0x0015, // 0x0015 = ftCmo
0x0012, // length of ftCmo data
0x0008, // object type, 0x0008 = picture
@ -2770,7 +2772,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
// ftEnd
$objData .=
pack('vv',
pack(
'vv',
0x0000, // 0x0000 = ftEnd
0x0000 // length of ftEnd data
);