diff --git a/Classes/PHPExcel/Reader/Excel2003XML.php b/Classes/PHPExcel/Reader/Excel2003XML.php
index b08ec864..17472d04 100644
--- a/Classes/PHPExcel/Reader/Excel2003XML.php
+++ b/Classes/PHPExcel/Reader/Excel2003XML.php
@@ -137,7 +137,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$worksheetNames = array();
- $xml = simplexml_load_file($pFilename);
+ $xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$namespaces = $xml->getNamespaces(true);
$xml_ss = $xml->children($namespaces['ss']);
@@ -165,7 +165,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
$worksheetInfo = array();
- $xml = simplexml_load_file($pFilename);
+ $xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$namespaces = $xml->getNamespaces(true);
$worksheetID = 1;
@@ -330,7 +330,7 @@ class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements P
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
}
- $xml = simplexml_load_file($pFilename);
+ $xml = simplexml_load_file($pFilename, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$namespaces = $xml->getNamespaces(true);
$docProps = $objPHPExcel->getProperties();
diff --git a/Classes/PHPExcel/Reader/Excel2007.php b/Classes/PHPExcel/Reader/Excel2007.php
index ed0376e7..05d053d1 100644
--- a/Classes/PHPExcel/Reader/Excel2007.php
+++ b/Classes/PHPExcel/Reader/Excel2007.php
@@ -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?
*
@@ -94,7 +94,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$zip = new $zipClass;
if ($zip->open($pFilename) === true) {
// check if it is an OOXML archive
- $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"));
+ $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if ($rels !== false) {
foreach ($rels->Relationship as $rel) {
switch ($rel["Type"]) {
@@ -113,7 +113,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return $xl;
}
-
+
/**
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
*
@@ -136,13 +136,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// The files we're looking at here are small enough that simpleXML is more efficient than XMLReader
$rels = simplexml_load_string(
- $this->_getFromZipArchive($zip, "_rels/.rels")
+ $this->_getFromZipArchive($zip, "_rels/.rels", 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())
); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($rels->Relationship as $rel) {
switch ($rel["Type"]) {
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
$xmlWorkbook = simplexml_load_string(
- $this->_getFromZipArchive($zip, "{$rel['Target']}")
+ $this->_getFromZipArchive($zip, "{$rel['Target']}", 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())
); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
if ($xmlWorkbook->sheets) {
@@ -160,56 +160,56 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
- /**
- * 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"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ 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"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ 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']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ 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");
+ $res = $xml->open('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet", null, PHPExcel_Settings::getLibXmlLoaderOptions());
$xml->setParserProperty(2,true);
$currCells = 0;
@@ -229,18 +229,18 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$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
';
$value = isset($c->v) ? (string) $c->v : NULL;
@@ -254,19 +254,19 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return $value;
} // function _castToBool()
-
+
private static function _castToError($c) {
// echo 'Initial Cast to Error
';
return isset($c->v) ? (string) $c->v : NULL;
} // function _castToError()
-
+
private static function _castToString($c) {
// echo 'Initial Cast to String
';
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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
}
-
+
public function _getFromZipArchive($archive, $fileName = '')
{
// Root-relative paths
@@ -333,7 +333,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return $contents;
}
-
+
/**
* Loads PHPExcel from file
*
@@ -361,19 +361,19 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$zip->open($pFilename);
// Read the theme first, because we need the colour scheme when reading the styles
- $wbRels = simplexml_load_string($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
+ $wbRels = simplexml_load_string($this->_getFromZipArchive($zip, "xl/_rels/workbook.xml.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($wbRels->Relationship as $rel) {
switch ($rel["Type"]) {
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
$themeOrderArray = array('lt1','dk1','lt2','dk2');
$themeOrderAdditional = count($themeOrderArray);
- $xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}"));
+ $xmlTheme = simplexml_load_string($this->_getFromZipArchive($zip, "xl/{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if (is_object($xmlTheme)) {
$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");
@@ -398,11 +398,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
}
- $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
+ $rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($rels->Relationship as $rel) {
switch ($rel["Type"]) {
case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
- $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"));
+ $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if (is_object($xmlCore)) {
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
$xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
@@ -421,7 +421,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
break;
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
- $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"));
+ $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if (is_object($xmlCore)) {
$docProps = $excel->getProperties();
if (isset($xmlCore->Company))
@@ -432,7 +432,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
break;
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
- $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"));
+ $xmlCore = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if (is_object($xmlCore)) {
$docProps = $excel->getProperties();
foreach ($xmlCore as $xmlProperty) {
@@ -458,12 +458,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
break;
case "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 = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
$sharedStrings = array();
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
- $xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
+ $xmlStrings = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
if (isset($xmlStrings) && isset($xmlStrings->si)) {
foreach ($xmlStrings->si as $val) {
if (isset($val->t)) {
@@ -502,7 +502,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$styles = array();
$cellStyles = array();
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
- $xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
+ $xmlStyles = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$xpath[Target]"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
$numFmts = null;
if ($xmlStyles && $xmlStyles->numFmts[0]) {
$numFmts = $xmlStyles->numFmts[0];
@@ -582,7 +582,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$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);
@@ -590,7 +590,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$dxfs[] = $style;
}
}
- // Cell Styles
+ // Cell Styles
if ($xmlStyles->cellStyles) {
foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
if (intval($cellStyle['builtinId']) == 0) {
@@ -606,7 +606,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
}
- $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
+ $xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
// Set base date
if ($xmlWorkbook->workbookPr) {
@@ -643,13 +643,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// 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");
+ $xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
$sharedFormulas = array();
@@ -666,10 +666,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
} 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.'
';
}
break;
@@ -985,7 +985,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
}
}
-
+
$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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
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"]);
- }
+ }
}
}
@@ -1233,7 +1233,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (!$this->_readDataOnly) {
// Locate hyperlink relations
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
- $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
+ $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
$hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
@@ -1274,7 +1274,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (!$this->_readDataOnly) {
// Locate comment relations
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
- $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
+ $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
$comments[(string)$ele["Id"]] = (string)$ele["Target"];
@@ -1289,7 +1289,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
foreach ($comments as $relName => $relPath) {
// Load comments file
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
- $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) );
+ $commentsFile = simplexml_load_string($this->_getFromZipArchive($zip, $relPath) , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
// Utility variables
$authors = array();
@@ -1310,7 +1310,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
foreach ($vmlComments as $relName => $relPath) {
// Load VML comments file
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
- $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) );
+ $vmlCommentsFile = simplexml_load_string( $this->_getFromZipArchive($zip, $relPath) , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
$shapes = $vmlCommentsFile->xpath('//v:shape');
@@ -1361,7 +1361,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// Header/footer images
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
- $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
+ $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$vmlRelationship = '';
foreach ($relsWorksheet->Relationship as $ele) {
@@ -1372,7 +1372,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if ($vmlRelationship != '') {
// Fetch linked images
- $relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' )); //~ http://schemas.openxmlformats.org/package/2006/relationships");
+ $relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' ), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$drawings = array();
foreach ($relsVML->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
@@ -1381,7 +1381,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
// Fetch VML document
- $vmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $vmlRelationship));
+ $vmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $vmlRelationship), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
$hfImages = array();
@@ -1420,7 +1420,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// TODO: Autoshapes from twoCellAnchors!
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
- $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
+ $relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$drawings = array();
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
@@ -1430,7 +1430,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if ($xmlSheet->drawing && !$this->_readDataOnly) {
foreach ($xmlSheet->drawing as $drawing) {
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
- $relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
+ $relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") , 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$images = array();
if ($relsDrawing && $relsDrawing->Relationship) {
@@ -1438,15 +1438,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
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");
+ $xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions())->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
if ($xmlDrawing->oneCellAnchor) {
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
@@ -1479,7 +1479,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
$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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
'toOffsetY' => $toOffsetY,
'worksheetTitle' => $docSheet->getTitle()
);
- }
+ }
}
}
@@ -1570,10 +1570,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// 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':
@@ -1710,13 +1710,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
if (!$this->_readDataOnly) {
- $contentTypes = simplexml_load_string($this->_getFromZipArchive($zip, "[Content_Types].xml"));
+ $contentTypes = simplexml_load_string($this->_getFromZipArchive($zip, "[Content_Types].xml"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
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));
+ $chartElements = simplexml_load_string($this->_getFromZipArchive($zip, $chartEntryRef), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml'));
// echo 'Chart ',$chartEntryRef,'
';
@@ -1727,7 +1727,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// echo 'Position Ref ',$chartPositionRef,'
';
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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$chartDetails[$chartPositionRef]['toOffsetY']
);
}
- }
+ }
}
}
}
@@ -1749,7 +1749,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
return $excel;
}
-
+
private static function _readColor($color, $background=FALSE) {
if (isset($color["rgb"])) {
@@ -1773,16 +1773,16 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
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 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$docStyle->setQuotePrefix($style->quotePrefix);
}
}
-
+
private static function _readBorder($docBorder, $eleBorder) {
if (isset($eleBorder["style"])) {
@@ -1914,7 +1914,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
}
}
-
+
private function _parseRichText($is = null) {
$value = new PHPExcel_RichText();
@@ -1990,7 +1990,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
$dataRels = $this->_getFromZipArchive($zip, $pathRels);
if ($dataRels) {
// exists and not empty if the ribbon have some pictures (other than internal MSO)
- $UIRels = simplexml_load_string($dataRels);
+ $UIRels = simplexml_load_string($dataRels, 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
if ($UIRels) {
// we need to save id and target to avoid parsing customUI.xml and "guess" if it's a pseudo callback who load the image
foreach ($UIRels->Relationship as $ele) {
@@ -1998,7 +1998,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
// an image ?
$customUIImagesNames[(string) $ele['Id']] = (string)$ele['Target'];
$customUIImagesBinaries[(string)$ele['Target']] = $this->_getFromZipArchive($zip, $baseDir . '/' . (string) $ele['Target']);
- }
+ }
}
}
}
@@ -2019,12 +2019,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
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);
diff --git a/Classes/PHPExcel/Reader/Gnumeric.php b/Classes/PHPExcel/Reader/Gnumeric.php
index 790192b2..d8121495 100644
--- a/Classes/PHPExcel/Reader/Gnumeric.php
+++ b/Classes/PHPExcel/Reader/Gnumeric.php
@@ -117,7 +117,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$xml = new XMLReader();
$xml->open(
- 'compress.zlib://'.realpath($pFilename)
+ 'compress.zlib://'.realpath($pFilename), null, PHPExcel_Settings::getLibXmlLoaderOptions()
);
$xml->setParserProperty(2,true);
@@ -151,7 +151,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
$xml = new XMLReader();
$xml->open(
- 'compress.zlib://'.realpath($pFilename)
+ 'compress.zlib://'.realpath($pFilename), null, PHPExcel_Settings::getLibXmlLoaderOptions()
);
$xml->setParserProperty(2,true);
@@ -243,7 +243,7 @@ class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPEx
// echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
// echo '
'; // print_r($namespacesMeta); @@ -431,7 +431,7 @@ class PHPExcel_Reader_OOCalc extends PHPExcel_Reader_Abstract implements PHPExce // echo 'Workbook Content
'; - $xml = simplexml_load_string($zip->getFromName("content.xml")); + $xml = simplexml_load_string($zip->getFromName("content.xml"), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); $namespacesContent = $xml->getNamespaces(true); // echo ''; // print_r($namespacesContent); diff --git a/Classes/PHPExcel/Settings.php b/Classes/PHPExcel/Settings.php index 5cf8ed65..03e1a264 100644 --- a/Classes/PHPExcel/Settings.php +++ b/Classes/PHPExcel/Settings.php @@ -105,6 +105,12 @@ class PHPExcel_Settings */ private static $_pdfRendererPath = NULL; + /** + * Default options for libxml loader + * + * @var int + */ + private static $_libXmlLoaderOptions = null; /** * Set the Zip handler Class that PHPExcel should use for Zip file management (PCLZip or ZipArchive) @@ -339,7 +345,6 @@ class PHPExcel_Settings return self::$_pdfRendererName; } // function getPdfRendererName() - /** * Return the directory path to the PDF Rendering Library that PHPExcel is currently configured to use * @@ -351,4 +356,30 @@ class PHPExcel_Settings return self::$_pdfRendererPath; } // function getPdfRendererPath() + /** + * Set default options for libxml loader + * + * @param int $options Default options for libxml loader + */ + public static function setLibXmlLoaderOptions($options = null) + { + if (is_null($options)) { + $options = LIBXML_DTDLOAD | LIBXML_DTDATTR; + } + self::$_libXmlLoaderOptions = $options; + } // function setLibXmlLoaderOptions + + /** + * Get default options for libxml loader. + * Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly. + * + * @return int Default options for libxml loader + */ + public static function getLibXmlLoaderOptions() + { + if (is_null(self::$_libXmlLoaderOptions)) { + self::$_libXmlLoaderOptions = LIBXML_DTDLOAD | LIBXML_DTDATTR; + } + return self::$_libXmlLoaderOptions; + } // function getLibXmlLoaderOptions } \ No newline at end of file