Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
BugFix Issue PHPOffice#248 - Excel2007 does not correctly mark rows a…
Browse files Browse the repository at this point in the history
…s hidden/not visible
Jazzo committed Dec 11, 2013

Verified

This commit was signed with the committer’s verified signature.
richardlau Richard Lau
1 parent fcb794e commit 3d10bdc
Showing 1 changed file with 217 additions and 217 deletions.
434 changes: 217 additions & 217 deletions Classes/PHPExcel/Reader/Excel2007.php
Original file line number Diff line number Diff line change
@@ -59,15 +59,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
private static $_theme = NULL;


/**
* Create a new PHPExcel_Reader_Excel2007 instance
*/
public function __construct() {
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
}


/**
* Create a new PHPExcel_Reader_Excel2007 instance
*/
public function __construct() {
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
}


/**
* Can the current PHPExcel_Reader_IReader read the file?
*
@@ -113,7 +113,7 @@ public function canRead($pFilename)
return $xl;
}



/**
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
*
@@ -160,53 +160,53 @@ public function listWorksheetNames($pFilename)
}


/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
*
* @param string $pFilename
* @throws PHPExcel_Reader_Exception
*/
public function listWorksheetInfo($pFilename)
{
// Check if file exists
if (!file_exists($pFilename)) {
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}

$worksheetInfo = array();

/**
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
*
* @param string $pFilename
* @throws PHPExcel_Reader_Exception
*/
public function listWorksheetInfo($pFilename)
{
// Check if file exists
if (!file_exists($pFilename)) {
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}

$worksheetInfo = array();

$zipClass = PHPExcel_Settings::getZipClass();

$zip = new $zipClass;
$zip->open($pFilename);

$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($rels->Relationship as $rel) {
if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
$dir = dirname($rel["Target"]);
$relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");

$worksheets = array();
foreach ($relsWorkbook->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
$worksheets[(string) $ele["Id"]] = $ele["Target"];
}
}

$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
if ($xmlWorkbook->sheets) {
$dir = dirname($rel["Target"]);
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
$tmpInfo = array(
'worksheetName' => (string) $eleSheet["name"],
'lastColumnLetter' => 'A',
'lastColumnIndex' => 0,
'totalRows' => 0,
'totalColumns' => 0,
$zip = new $zipClass;
$zip->open($pFilename);

$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($rels->Relationship as $rel) {
if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
$dir = dirname($rel["Target"]);
$relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");

$worksheets = array();
foreach ($relsWorkbook->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
$worksheets[(string) $ele["Id"]] = $ele["Target"];
}
}

$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
if ($xmlWorkbook->sheets) {
$dir = dirname($rel["Target"]);
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
$tmpInfo = array(
'worksheetName' => (string) $eleSheet["name"],
'lastColumnLetter' => 'A',
'lastColumnIndex' => 0,
'totalRows' => 0,
'totalColumns' => 0,
);

$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];

$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];

$xml = new XMLReader();
$res = $xml->open('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet");
@@ -229,18 +229,18 @@ public function listWorksheetInfo($pFilename)
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);

$worksheetInfo[] = $tmpInfo;
}
}
}
}

$zip->close();

return $worksheetInfo;
}


$worksheetInfo[] = $tmpInfo;
}
}
}
}

$zip->close();

return $worksheetInfo;
}


private static function _castToBool($c) {
// echo 'Initial Cast to Boolean<br />';
$value = isset($c->v) ? (string) $c->v : NULL;
@@ -254,19 +254,19 @@ private static function _castToBool($c) {
return $value;
} // function _castToBool()



private static function _castToError($c) {
// echo 'Initial Cast to Error<br />';
return isset($c->v) ? (string) $c->v : NULL;
} // function _castToError()



private static function _castToString($c) {
// echo 'Initial Cast to String<br />';
return isset($c->v) ? (string) $c->v : NULL;
} // function _castToString()



private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
// echo 'Formula',PHP_EOL;
// echo '$c->f is '.$c->f.PHP_EOL;
@@ -313,7 +313,7 @@ private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&
}
}



public function _getFromZipArchive($archive, $fileName = '')
{
// Root-relative paths
@@ -333,7 +333,7 @@ public function _getFromZipArchive($archive, $fileName = '')
return $contents;
}



/**
* Loads PHPExcel from file
*
@@ -373,7 +373,7 @@ public function load($pFilename)
$xmlThemeName = $xmlTheme->attributes();
$xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
$themeName = (string)$xmlThemeName['name'];


$colourScheme = $xmlTheme->themeElements->clrScheme->attributes();
$colourSchemeName = (string)$colourScheme['name'];
$colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
@@ -582,15 +582,15 @@ public function load($pFilename)

$dxfs = array();
if (!$this->_readDataOnly && $xmlStyles) {
// Conditional Styles
// Conditional Styles
if ($xmlStyles->dxfs) {
foreach ($xmlStyles->dxfs->dxf as $dxf) {
$style = new PHPExcel_Style(FALSE, TRUE);
self::_readStyle($style, $dxf);
$dxfs[] = $style;
}
}
// Cell Styles
// Cell Styles
if ($xmlStyles->cellStyles) {
foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
if (intval($cellStyle['builtinId']) == 0) {
@@ -643,10 +643,10 @@ public function load($pFilename)

// Load sheet
$docSheet = $excel->createSheet();
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet
// references in formula cells... during the load, all formulae should be correct,
// and we're simply bringing the worksheet name in line with the formula, not the
// reverse
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet
// references in formula cells... during the load, all formulae should be correct,
// and we're simply bringing the worksheet name in line with the formula, not the
// reverse
$docSheet->setTitle((string) $eleSheet["name"],false);
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
$xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
@@ -666,10 +666,10 @@ public function load($pFilename)
$docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) );
}

if (isset($xmlSheet->sheetViews->sheetView['view'])) {
$docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
}

if (isset($xmlSheet->sheetViews->sheetView['view'])) {
$docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
}

if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) {
$docSheet->setShowGridLines(self::boolean((string)$xmlSheet->sheetViews->sheetView['showGridLines']));
}
@@ -754,9 +754,9 @@ public function load($pFilename)
if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) {
$docSheet->getDefaultColumnDimension()->setWidth( (float)$xmlSheet->sheetFormatPr['defaultColWidth'] );
}
if (isset($xmlSheet->sheetFormatPr['zeroHeight']) &&
((string)$xmlSheet->sheetFormatPr['zeroHeight'] == '1')) {
$docSheet->getDefaultRowDimension()->setzeroHeight(true);
if (isset($xmlSheet->sheetFormatPr['zeroHeight']) &&
((string)$xmlSheet->sheetFormatPr['zeroHeight'] == '1')) {
$docSheet->getDefaultRowDimension()->setzeroHeight(true);
}
}

@@ -864,11 +864,11 @@ public function load($pFilename)
} else {
// Formula
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool');
if (isset($c->f['t'])) {
$att = array();
$att = $c->f;
$docSheet->getCell($r)->setFormulaAttributes($att);
}
if (isset($c->f['t'])) {
$att = array();
$att = $c->f;
$docSheet->getCell($r)->setFormulaAttributes($att);
}
// echo '$calculatedValue = '.$calculatedValue.'<br />';
}
break;
@@ -985,7 +985,7 @@ public function load($pFilename)
}
}
}


$aKeys = array("sheet", "objects", "scenarios", "formatCells", "formatColumns", "formatRows", "insertColumns", "insertRows", "insertHyperlinks", "deleteColumns", "deleteRows", "selectLockedCells", "sort", "autoFilter", "pivotTables", "selectUnlockedCells");
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) {
foreach ($aKeys as $key) {
@@ -1004,111 +1004,111 @@ public function load($pFilename)
}

if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) {
$autoFilter = $docSheet->getAutoFilter();
$autoFilter = $docSheet->getAutoFilter();
$autoFilter->setRange((string) $xmlSheet->autoFilter["ref"]);
foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) {
$column = $autoFilter->getColumnByOffset((integer) $filterColumn["colId"]);
// Check for standard filters
if ($filterColumn->filters) {
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER);
$filters = $filterColumn->filters;
if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
$column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL
''
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
}
// Standard filters are always an OR join, so no join rule needs to be set
// Entries can be either filter elements
foreach ($filters->filter as $filterRule) {
$column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL
(string) $filterRule["val"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
}
// Or Date Group elements
foreach ($filters->dateGroupItem as $dateGroupItem) {
$column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL
array(
'year' => (string) $dateGroupItem["year"],
'month' => (string) $dateGroupItem["month"],
'day' => (string) $dateGroupItem["day"],
'hour' => (string) $dateGroupItem["hour"],
'minute' => (string) $dateGroupItem["minute"],
'second' => (string) $dateGroupItem["second"],
),
(string) $dateGroupItem["dateTimeGrouping"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
}
}
// Check for custom filters
if ($filterColumn->customFilters) {
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER);
$customFilters = $filterColumn->customFilters;
// Custom filters can an AND or an OR join;
// and there should only ever be one or two entries
if ((isset($customFilters["and"])) && ($customFilters["and"] == 1)) {
$column->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
}
foreach ($customFilters->customFilter as $filterRule) {
$column->createRule()->setRule(
(string) $filterRule["operator"],
(string) $filterRule["val"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
}
}
// Check for dynamic filters
if ($filterColumn->dynamicFilter) {
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
// We should only ever have one dynamic filter
foreach ($filterColumn->dynamicFilter as $filterRule) {
$column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL
(string) $filterRule["val"],
(string) $filterRule["type"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
if (isset($filterRule["val"])) {
$column->setAttribute('val',(string) $filterRule["val"]);
}
if (isset($filterRule["maxVal"])) {
$column->setAttribute('maxVal',(string) $filterRule["maxVal"]);
}
}
}
// Check for dynamic filters
if ($filterColumn->top10) {
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER);
// We should only ever have one top10 filter
foreach ($filterColumn->top10 as $filterRule) {
$column->createRule()->setRule(
(((isset($filterRule["percent"])) && ($filterRule["percent"] == 1))
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE
),
(string) $filterRule["val"],
(((isset($filterRule["top"])) && ($filterRule["top"] == 1))
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
)
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER);
}
}
}
foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) {
$column = $autoFilter->getColumnByOffset((integer) $filterColumn["colId"]);
// Check for standard filters
if ($filterColumn->filters) {
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER);
$filters = $filterColumn->filters;
if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
$column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL
''
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
}
// Standard filters are always an OR join, so no join rule needs to be set
// Entries can be either filter elements
foreach ($filters->filter as $filterRule) {
$column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL
(string) $filterRule["val"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
}
// Or Date Group elements
foreach ($filters->dateGroupItem as $dateGroupItem) {
$column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL
array(
'year' => (string) $dateGroupItem["year"],
'month' => (string) $dateGroupItem["month"],
'day' => (string) $dateGroupItem["day"],
'hour' => (string) $dateGroupItem["hour"],
'minute' => (string) $dateGroupItem["minute"],
'second' => (string) $dateGroupItem["second"],
),
(string) $dateGroupItem["dateTimeGrouping"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
}
}
// Check for custom filters
if ($filterColumn->customFilters) {
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER);
$customFilters = $filterColumn->customFilters;
// Custom filters can an AND or an OR join;
// and there should only ever be one or two entries
if ((isset($customFilters["and"])) && ($customFilters["and"] == 1)) {
$column->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
}
foreach ($customFilters->customFilter as $filterRule) {
$column->createRule()->setRule(
(string) $filterRule["operator"],
(string) $filterRule["val"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
}
}
// Check for dynamic filters
if ($filterColumn->dynamicFilter) {
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
// We should only ever have one dynamic filter
foreach ($filterColumn->dynamicFilter as $filterRule) {
$column->createRule()->setRule(
NULL, // Operator is undefined, but always treated as EQUAL
(string) $filterRule["val"],
(string) $filterRule["type"]
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
if (isset($filterRule["val"])) {
$column->setAttribute('val',(string) $filterRule["val"]);
}
if (isset($filterRule["maxVal"])) {
$column->setAttribute('maxVal',(string) $filterRule["maxVal"]);
}
}
}
// Check for dynamic filters
if ($filterColumn->top10) {
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER);
// We should only ever have one top10 filter
foreach ($filterColumn->top10 as $filterRule) {
$column->createRule()->setRule(
(((isset($filterRule["percent"])) && ($filterRule["percent"] == 1))
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE
),
(string) $filterRule["val"],
(((isset($filterRule["top"])) && ($filterRule["top"] == 1))
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
)
)
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER);
}
}
}
}

if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) {
foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) {
$mergeRef = (string) $mergeCell["ref"];
if (strpos($mergeRef,':') !== FALSE) {
$mergeRef = (string) $mergeCell["ref"];
if (strpos($mergeRef,':') !== FALSE) {
$docSheet->mergeCells((string) $mergeCell["ref"]);
}
}
}
}

@@ -1438,12 +1438,12 @@ public function load($pFilename)
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
} elseif ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart") {
if ($this->_includeCharts) {
if ($this->_includeCharts) {
$charts[self::dir_add($fileDrawing, $ele["Target"])] = array('id' => (string) $ele["Id"],
'sheet' => $docSheet->getTitle()
);
}
}
}
}
}
$xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
@@ -1479,7 +1479,7 @@ public function load($pFilename)
}
$objDrawing->setWorksheet($docSheet);
} else {
// ? Can charts be positioned with a oneCellAnchor ?
// ? Can charts be positioned with a oneCellAnchor ?
$coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1);
$offsetX = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff);
$offsetY = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff);
@@ -1520,7 +1520,7 @@ public function load($pFilename)
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
}
$objDrawing->setWorksheet($docSheet);
} elseif(($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) {
} elseif(($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) {
$fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
$fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff);
$fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
@@ -1540,7 +1540,7 @@ public function load($pFilename)
'toOffsetY' => $toOffsetY,
'worksheetTitle' => $docSheet->getTitle()
);
}
}
}
}

@@ -1570,10 +1570,10 @@ public function load($pFilename)
// Switch on type
switch ((string)$definedName['name']) {

case '_xlnm._FilterDatabase':
if ((string)$definedName['hidden'] !== '1') {
case '_xlnm._FilterDatabase':
if ((string)$definedName['hidden'] !== '1') {
$docSheet->getAutoFilter()->setRange($extractedRange);
}
}
break;

case '_xlnm.Print_Titles':
@@ -1714,7 +1714,7 @@ public function load($pFilename)
foreach ($contentTypes->Override as $contentType) {
switch ($contentType["ContentType"]) {
case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml":
if ($this->_includeCharts) {
if ($this->_includeCharts) {
$chartEntryRef = ltrim($contentType['PartName'],'/');
$chartElements = simplexml_load_string($this->_getFromZipArchive($zip, $chartEntryRef));
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml'));
@@ -1727,7 +1727,7 @@ public function load($pFilename)
// echo 'Position Ref ',$chartPositionRef,'<br />';
if (isset($chartDetails[$chartPositionRef])) {
// var_dump($chartDetails[$chartPositionRef]);


$excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart);
$objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet']));
$objChart->setTopLeftPosition( $chartDetails[$chartPositionRef]['fromCoordinate'],
@@ -1739,7 +1739,7 @@ public function load($pFilename)
$chartDetails[$chartPositionRef]['toOffsetY']
);
}
}
}
}
}
}
@@ -1749,7 +1749,7 @@ public function load($pFilename)

return $excel;
}



private static function _readColor($color, $background=FALSE) {
if (isset($color["rgb"])) {
@@ -1773,16 +1773,16 @@ private static function _readColor($color, $background=FALSE) {
return 'FF000000';
}



private static function _readStyle($docStyle, $style) {
// format code
// if (isset($style->numFmt)) {
// if (isset($style->numFmt['formatCode'])) {
// $docStyle->getNumberFormat()->setFormatCode((string) $style->numFmt['formatCode']);
// if (isset($style->numFmt)) {
// if (isset($style->numFmt['formatCode'])) {
// $docStyle->getNumberFormat()->setFormatCode((string) $style->numFmt['formatCode']);
// } else {
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
// }
// }
// }
// }

// font
if (isset($style->font)) {
@@ -1820,7 +1820,7 @@ private static function _readStyle($docStyle, $style) {
if (isset($style->fill)) {
if ($style->fill->gradientFill) {
$gradientFill = $style->fill->gradientFill[0];
if(!empty($gradientFill["type"])) {
if(!empty($gradientFill["type"])) {
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
}
$docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
@@ -1903,7 +1903,7 @@ private static function _readStyle($docStyle, $style) {
$docStyle->setQuotePrefix($style->quotePrefix);
}
}



private static function _readBorder($docBorder, $eleBorder) {
if (isset($eleBorder["style"])) {
@@ -1914,7 +1914,7 @@ private static function _readBorder($docBorder, $eleBorder) {
}
}



private function _parseRichText($is = null) {
$value = new PHPExcel_RichText();

@@ -1998,7 +1998,7 @@ private function _readRibbon($excel, $customUITarget, $zip)
// an image ?
$customUIImagesNames[(string) $ele['Id']] = (string)$ele['Target'];
$customUIImagesBinaries[(string)$ele['Target']] = $this->_getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']);
}
}
}
}
}
@@ -2019,12 +2019,12 @@ private static function array_item($array, $key = 0) {
return (isset($array[$key]) ? $array[$key] : null);
}



private static function dir_add($base, $add) {
return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
}



private static function toCSSArray($style) {
$style = str_replace(array("\r","\n"), "", $style);

@@ -2055,11 +2055,11 @@ private static function toCSSArray($style) {
return $style;
}

private static function boolean($value = NULL)
private static function boolean($value = null)
{
if (is_numeric($value)) {
if (is_numeric($value) || is_object($value)) {
return (bool) $value;
}
return ($value === 'true' || $value === 'TRUE') ? TRUE : FALSE;
return ($value === 'true' || $value === 'TRUE') ? true : false;
}
}

0 comments on commit 3d10bdc

Please sign in to comment.