|
|
@ -94,7 +94,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$zip = new $zipClass;
|
|
|
|
$zip = new $zipClass;
|
|
|
|
if ($zip->open($pFilename) === true) {
|
|
|
|
if ($zip->open($pFilename) === true) {
|
|
|
|
// check if it is an OOXML archive
|
|
|
|
// 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) {
|
|
|
|
if ($rels !== false) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
@ -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
|
|
|
|
// The files we're looking at here are small enough that simpleXML is more efficient than XMLReader
|
|
|
|
$rels = simplexml_load_string(
|
|
|
|
$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");
|
|
|
|
); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
|
|
|
$xmlWorkbook = simplexml_load_string(
|
|
|
|
$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");
|
|
|
|
); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
|
|
|
|
|
|
|
|
|
|
|
if ($xmlWorkbook->sheets) {
|
|
|
|
if ($xmlWorkbook->sheets) {
|
|
|
@ -180,11 +180,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$zip = new $zipClass;
|
|
|
|
$zip = new $zipClass;
|
|
|
|
$zip->open($pFilename);
|
|
|
|
$zip->open($pFilename);
|
|
|
|
|
|
|
|
|
|
|
|
$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) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
|
|
|
|
if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
$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");
|
|
|
|
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
|
|
|
|
|
|
|
|
$worksheets = array();
|
|
|
|
$worksheets = array();
|
|
|
@ -194,7 +194,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");
|
|
|
|
if ($xmlWorkbook->sheets) {
|
|
|
|
if ($xmlWorkbook->sheets) {
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
|
|
|
|
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
|
|
|
@ -209,7 +209,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$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();
|
|
|
|
$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);
|
|
|
|
$xml->setParserProperty(2,true);
|
|
|
|
|
|
|
|
|
|
|
|
$currCells = 0;
|
|
|
|
$currCells = 0;
|
|
|
@ -361,14 +361,14 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$zip->open($pFilename);
|
|
|
|
$zip->open($pFilename);
|
|
|
|
|
|
|
|
|
|
|
|
// Read the theme first, because we need the colour scheme when reading the styles
|
|
|
|
// 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) {
|
|
|
|
foreach ($wbRels->Relationship as $rel) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
|
|
|
|
$themeOrderArray = array('lt1','dk1','lt2','dk2');
|
|
|
|
$themeOrderArray = array('lt1','dk1','lt2','dk2');
|
|
|
|
$themeOrderAdditional = count($themeOrderArray);
|
|
|
|
$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)) {
|
|
|
|
if (is_object($xmlTheme)) {
|
|
|
|
$xmlThemeName = $xmlTheme->attributes();
|
|
|
|
$xmlThemeName = $xmlTheme->attributes();
|
|
|
|
$xmlTheme = $xmlTheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
|
|
|
|
$xmlTheme = $xmlTheme->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) {
|
|
|
|
foreach ($rels->Relationship as $rel) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
switch ($rel["Type"]) {
|
|
|
|
case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
|
|
|
|
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)) {
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
|
|
|
|
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
|
|
|
|
$xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
|
|
|
|
$xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
|
|
|
@ -421,7 +421,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
|
|
|
|
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)) {
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
$docProps = $excel->getProperties();
|
|
|
|
$docProps = $excel->getProperties();
|
|
|
|
if (isset($xmlCore->Company))
|
|
|
|
if (isset($xmlCore->Company))
|
|
|
@ -432,7 +432,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
|
|
|
|
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)) {
|
|
|
|
if (is_object($xmlCore)) {
|
|
|
|
$docProps = $excel->getProperties();
|
|
|
|
$docProps = $excel->getProperties();
|
|
|
|
foreach ($xmlCore as $xmlProperty) {
|
|
|
|
foreach ($xmlCore as $xmlProperty) {
|
|
|
@ -458,12 +458,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
|
|
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
|
|
|
|
$dir = dirname($rel["Target"]);
|
|
|
|
$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");
|
|
|
|
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
|
|
|
|
|
|
|
|
|
|
|
$sharedStrings = array();
|
|
|
|
$sharedStrings = array();
|
|
|
|
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
|
|
|
|
$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)) {
|
|
|
|
if (isset($xmlStrings) && isset($xmlStrings->si)) {
|
|
|
|
foreach ($xmlStrings->si as $val) {
|
|
|
|
foreach ($xmlStrings->si as $val) {
|
|
|
|
if (isset($val->t)) {
|
|
|
|
if (isset($val->t)) {
|
|
|
@ -502,7 +502,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$styles = array();
|
|
|
|
$styles = array();
|
|
|
|
$cellStyles = array();
|
|
|
|
$cellStyles = array();
|
|
|
|
$xpath = self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
|
|
|
|
$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;
|
|
|
|
$numFmts = null;
|
|
|
|
if ($xmlStyles && $xmlStyles->numFmts[0]) {
|
|
|
|
if ($xmlStyles && $xmlStyles->numFmts[0]) {
|
|
|
|
$numFmts = $xmlStyles->numFmts[0];
|
|
|
|
$numFmts = $xmlStyles->numFmts[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
|
|
|
|
// Set base date
|
|
|
|
if ($xmlWorkbook->workbookPr) {
|
|
|
|
if ($xmlWorkbook->workbookPr) {
|
|
|
@ -649,7 +649,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
// reverse
|
|
|
|
// reverse
|
|
|
|
$docSheet->setTitle((string) $eleSheet["name"],false);
|
|
|
|
$docSheet->setTitle((string) $eleSheet["name"],false);
|
|
|
|
$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")];
|
|
|
|
$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();
|
|
|
|
$sharedFormulas = array();
|
|
|
|
|
|
|
|
|
|
|
@ -1233,7 +1233,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
// Locate hyperlink relations
|
|
|
|
// Locate hyperlink relations
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
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) {
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
|
|
|
|
$hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
|
|
|
|
$hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
|
|
|
@ -1274,7 +1274,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
// Locate comment relations
|
|
|
|
// Locate comment relations
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
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) {
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
|
|
|
|
$comments[(string)$ele["Id"]] = (string)$ele["Target"];
|
|
|
|
$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) {
|
|
|
|
foreach ($comments as $relName => $relPath) {
|
|
|
|
// Load comments file
|
|
|
|
// Load comments file
|
|
|
|
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
|
|
|
$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
|
|
|
|
// Utility variables
|
|
|
|
$authors = array();
|
|
|
|
$authors = array();
|
|
|
@ -1310,7 +1310,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
foreach ($vmlComments as $relName => $relPath) {
|
|
|
|
foreach ($vmlComments as $relName => $relPath) {
|
|
|
|
// Load VML comments file
|
|
|
|
// Load VML comments file
|
|
|
|
$relPath = PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet") . "/" . $relPath);
|
|
|
|
$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');
|
|
|
|
$vmlCommentsFile->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
|
|
|
|
|
|
|
|
|
|
|
$shapes = $vmlCommentsFile->xpath('//v:shape');
|
|
|
|
$shapes = $vmlCommentsFile->xpath('//v:shape');
|
|
|
@ -1361,7 +1361,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
// Header/footer images
|
|
|
|
// Header/footer images
|
|
|
|
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
|
|
|
|
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
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 = '';
|
|
|
|
$vmlRelationship = '';
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
@ -1372,7 +1372,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
if ($vmlRelationship != '') {
|
|
|
|
if ($vmlRelationship != '') {
|
|
|
|
// Fetch linked images
|
|
|
|
// 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();
|
|
|
|
$drawings = array();
|
|
|
|
foreach ($relsVML->Relationship as $ele) {
|
|
|
|
foreach ($relsVML->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
|
|
|
|
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
|
|
|
|
// 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');
|
|
|
|
$vmlDrawing->registerXPathNamespace('v', 'urn:schemas-microsoft-com:vml');
|
|
|
|
|
|
|
|
|
|
|
|
$hfImages = array();
|
|
|
|
$hfImages = array();
|
|
|
@ -1420,7 +1420,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Autoshapes from twoCellAnchors!
|
|
|
|
// TODO: Autoshapes from twoCellAnchors!
|
|
|
|
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
|
|
|
|
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();
|
|
|
|
$drawings = array();
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
foreach ($relsWorksheet->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
|
|
|
|
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) {
|
|
|
|
if ($xmlSheet->drawing && !$this->_readDataOnly) {
|
|
|
|
foreach ($xmlSheet->drawing as $drawing) {
|
|
|
|
foreach ($xmlSheet->drawing as $drawing) {
|
|
|
|
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
|
|
|
$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();
|
|
|
|
$images = array();
|
|
|
|
|
|
|
|
|
|
|
|
if ($relsDrawing && $relsDrawing->Relationship) {
|
|
|
|
if ($relsDrawing && $relsDrawing->Relationship) {
|
|
|
@ -1446,7 +1446,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$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) {
|
|
|
|
if ($xmlDrawing->oneCellAnchor) {
|
|
|
|
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
|
|
|
|
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
|
|
|
@ -1710,13 +1710,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$this->_readDataOnly) {
|
|
|
|
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) {
|
|
|
|
foreach ($contentTypes->Override as $contentType) {
|
|
|
|
switch ($contentType["ContentType"]) {
|
|
|
|
switch ($contentType["ContentType"]) {
|
|
|
|
case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml":
|
|
|
|
case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml":
|
|
|
|
if ($this->_includeCharts) {
|
|
|
|
if ($this->_includeCharts) {
|
|
|
|
$chartEntryRef = ltrim($contentType['PartName'],'/');
|
|
|
|
$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'));
|
|
|
|
$objChart = PHPExcel_Reader_Excel2007_Chart::readChart($chartElements,basename($chartEntryRef,'.xml'));
|
|
|
|
|
|
|
|
|
|
|
|
// echo 'Chart ',$chartEntryRef,'<br />';
|
|
|
|
// echo 'Chart ',$chartEntryRef,'<br />';
|
|
|
@ -1990,7 +1990,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$dataRels = $this->_getFromZipArchive($zip, $pathRels);
|
|
|
|
$dataRels = $this->_getFromZipArchive($zip, $pathRels);
|
|
|
|
if ($dataRels) {
|
|
|
|
if ($dataRels) {
|
|
|
|
// exists and not empty if the ribbon have some pictures (other than internal MSO)
|
|
|
|
// 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) {
|
|
|
|
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
|
|
|
|
// 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) {
|
|
|
|
foreach ($UIRels->Relationship as $ele) {
|
|
|
|