PSR-2 : Fixes
This commit is contained in:
parent
2881bca443
commit
7d086fdbee
|
@ -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;
|
||||
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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()) {
|
||||
|
@ -116,7 +116,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
|||
$objWriter->startElement('si');
|
||||
|
||||
if (! $textElement instanceof PHPExcel_RichText) {
|
||||
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $textElement );
|
||||
$textToWrite = PHPExcel_Shared_String::ControlCharacterPHP2OOXML($textElement);
|
||||
$objWriter->startElement('t');
|
||||
if ($textToWrite !== trim($textToWrite)) {
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
|
@ -147,10 +147,12 @@ 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) {
|
||||
|
@ -214,7 +216,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
|||
// t
|
||||
$objWriter->startElement($prefix.'t');
|
||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
|
||||
$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,8 +239,10 @@ 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) {
|
||||
|
@ -287,7 +291,7 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
|
|||
// t
|
||||
$objWriter->startElement($prefix.'t');
|
||||
// $objWriter->writeAttribute('xml:space', 'preserve'); // Excel2010 accepts, Excel2007 complains
|
||||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML( $element->getText() ));
|
||||
$objWriter->writeRawData(PHPExcel_Shared_String::ControlCharacterPHP2OOXML($element->getText()));
|
||||
$objWriter->endElement();
|
||||
|
||||
$objWriter->endElement();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -205,16 +205,16 @@ 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');
|
||||
|
@ -282,8 +282,12 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,7 +331,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
|
||||
// Set Zero Height row
|
||||
if ((string)$pSheet->getDefaultRowDimension()->getZeroHeight() == '1' ||
|
||||
strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true' ) {
|
||||
strtolower((string)$pSheet->getDefaultRowDimension()->getZeroHeight()) == 'true') {
|
||||
$objWriter->writeAttribute('zeroHeight', '1');
|
||||
}
|
||||
|
||||
|
@ -473,7 +477,7 @@ 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) {
|
||||
|
@ -484,7 +488,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
// cfRule
|
||||
$objWriter->startElement('cfRule');
|
||||
$objWriter->writeAttribute('type', $conditional->getConditionType());
|
||||
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode( $conditional->getHashCode() ));
|
||||
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
|
||||
$objWriter->writeAttribute('priority', $id++);
|
||||
|
||||
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|
||||
|
@ -772,7 +776,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
$objWriter->startElement('filterColumn');
|
||||
$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);
|
||||
}
|
||||
|
@ -787,11 +791,11 @@ 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) {
|
||||
|
@ -984,12 +988,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
|
|||
$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;
|
||||
$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
|
||||
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
|
@ -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)
|
||||
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 != '.')) {
|
||||
return $token;
|
||||
}
|
||||
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)
|
||||
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 != '.')) {
|
||||
return $token;
|
||||
}
|
||||
} 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
|
||||
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)) {
|
||||
return $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", $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
|
||||
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)) {
|
||||
return $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", $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
|
||||
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)) {
|
||||
return $token;
|
||||
}
|
||||
} 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)
|
||||
elseif (is_numeric($token) and
|
||||
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
|
||||
($this->_lookahead != '!') and ($this->_lookahead != ':')) {
|
||||
return $token;
|
||||
}
|
||||
} elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
|
||||
// If it's a string (of maximum 255 characters)
|
||||
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
|
||||
return $token;
|
||||
}
|
||||
} elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
|
||||
// If it's an error code
|
||||
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
|
||||
return $token;
|
||||
}
|
||||
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
|
||||
// if it's a function call
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
|
||||
return $token;
|
||||
}
|
||||
} elseif (substr($token, -1) == ')') {
|
||||
// It's an argument of some description (e.g. a named range),
|
||||
// precise nature yet to be determined
|
||||
elseif (substr($token,-1) == ')') {
|
||||
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']);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue