|
|
@ -59,15 +59,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
private static $_theme = NULL;
|
|
|
|
private static $_theme = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Create a new PHPExcel_Reader_Excel2007 instance
|
|
|
|
* Create a new PHPExcel_Reader_Excel2007 instance
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function __construct() {
|
|
|
|
public function __construct() {
|
|
|
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
|
|
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
|
|
|
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
|
|
|
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Can the current PHPExcel_Reader_IReader read the file?
|
|
|
|
* 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;
|
|
|
|
$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"]) {
|
|
|
@ -113,7 +113,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
return $xl;
|
|
|
|
return $xl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
|
|
|
* 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
|
|
|
|
// 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) {
|
|
|
@ -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)
|
|
|
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param string $pFilename
|
|
|
|
* @param string $pFilename
|
|
|
|
* @throws PHPExcel_Reader_Exception
|
|
|
|
* @throws PHPExcel_Reader_Exception
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function listWorksheetInfo($pFilename)
|
|
|
|
public function listWorksheetInfo($pFilename)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Check if file exists
|
|
|
|
// Check if file exists
|
|
|
|
if (!file_exists($pFilename)) {
|
|
|
|
if (!file_exists($pFilename)) {
|
|
|
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
|
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$worksheetInfo = array();
|
|
|
|
$worksheetInfo = array();
|
|
|
|
|
|
|
|
|
|
|
|
$zipClass = PHPExcel_Settings::getZipClass();
|
|
|
|
$zipClass = PHPExcel_Settings::getZipClass();
|
|
|
|
|
|
|
|
|
|
|
|
$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();
|
|
|
|
foreach ($relsWorkbook->Relationship as $ele) {
|
|
|
|
foreach ($relsWorkbook->Relationship as $ele) {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
|
|
|
|
$worksheets[(string) $ele["Id"]] = $ele["Target"];
|
|
|
|
$worksheets[(string) $ele["Id"]] = $ele["Target"];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$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) {
|
|
|
|
$tmpInfo = array(
|
|
|
|
$tmpInfo = array(
|
|
|
|
'worksheetName' => (string) $eleSheet["name"],
|
|
|
|
'worksheetName' => (string) $eleSheet["name"],
|
|
|
|
'lastColumnLetter' => 'A',
|
|
|
|
'lastColumnLetter' => 'A',
|
|
|
|
'lastColumnIndex' => 0,
|
|
|
|
'lastColumnIndex' => 0,
|
|
|
|
'totalRows' => 0,
|
|
|
|
'totalRows' => 0,
|
|
|
|
'totalColumns' => 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();
|
|
|
|
$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;
|
|
|
@ -229,18 +229,18 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
|
|
|
|
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
|
|
|
|
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
|
|
|
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
|
|
|
|
|
|
|
|
|
|
|
$worksheetInfo[] = $tmpInfo;
|
|
|
|
$worksheetInfo[] = $tmpInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$zip->close();
|
|
|
|
$zip->close();
|
|
|
|
|
|
|
|
|
|
|
|
return $worksheetInfo;
|
|
|
|
return $worksheetInfo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function _castToBool($c) {
|
|
|
|
private static function _castToBool($c) {
|
|
|
|
// echo 'Initial Cast to Boolean<br />';
|
|
|
|
// echo 'Initial Cast to Boolean<br />';
|
|
|
|
$value = isset($c->v) ? (string) $c->v : NULL;
|
|
|
|
$value = isset($c->v) ? (string) $c->v : NULL;
|
|
|
@ -254,19 +254,19 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
return $value;
|
|
|
|
return $value;
|
|
|
|
} // function _castToBool()
|
|
|
|
} // function _castToBool()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function _castToError($c) {
|
|
|
|
private static function _castToError($c) {
|
|
|
|
// echo 'Initial Cast to Error<br />';
|
|
|
|
// echo 'Initial Cast to Error<br />';
|
|
|
|
return isset($c->v) ? (string) $c->v : NULL;
|
|
|
|
return isset($c->v) ? (string) $c->v : NULL;
|
|
|
|
} // function _castToError()
|
|
|
|
} // function _castToError()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function _castToString($c) {
|
|
|
|
private static function _castToString($c) {
|
|
|
|
// echo 'Initial Cast to String<br />';
|
|
|
|
// echo 'Initial Cast to String<br />';
|
|
|
|
return isset($c->v) ? (string) $c->v : NULL;
|
|
|
|
return isset($c->v) ? (string) $c->v : NULL;
|
|
|
|
} // function _castToString()
|
|
|
|
} // function _castToString()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
|
|
|
|
private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
|
|
|
|
// echo 'Formula',PHP_EOL;
|
|
|
|
// echo 'Formula',PHP_EOL;
|
|
|
|
// echo '$c->f is '.$c->f.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 = '')
|
|
|
|
public function _getFromZipArchive($archive, $fileName = '')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Root-relative paths
|
|
|
|
// Root-relative paths
|
|
|
@ -333,7 +333,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
return $contents;
|
|
|
|
return $contents;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Loads PHPExcel from file
|
|
|
|
* Loads PHPExcel from file
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -361,19 +361,19 @@ 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");
|
|
|
|
$themeName = (string)$xmlThemeName['name'];
|
|
|
|
$themeName = (string)$xmlThemeName['name'];
|
|
|
|
|
|
|
|
|
|
|
|
$colourScheme = $xmlTheme->themeElements->clrScheme->attributes();
|
|
|
|
$colourScheme = $xmlTheme->themeElements->clrScheme->attributes();
|
|
|
|
$colourSchemeName = (string)$colourScheme['name'];
|
|
|
|
$colourSchemeName = (string)$colourScheme['name'];
|
|
|
|
$colourScheme = $xmlTheme->themeElements->clrScheme->children("http://schemas.openxmlformats.org/drawingml/2006/main");
|
|
|
|
$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) {
|
|
|
|
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];
|
|
|
@ -582,7 +582,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
$dxfs = array();
|
|
|
|
$dxfs = array();
|
|
|
|
if (!$this->_readDataOnly && $xmlStyles) {
|
|
|
|
if (!$this->_readDataOnly && $xmlStyles) {
|
|
|
|
// Conditional Styles
|
|
|
|
// Conditional Styles
|
|
|
|
if ($xmlStyles->dxfs) {
|
|
|
|
if ($xmlStyles->dxfs) {
|
|
|
|
foreach ($xmlStyles->dxfs->dxf as $dxf) {
|
|
|
|
foreach ($xmlStyles->dxfs->dxf as $dxf) {
|
|
|
|
$style = new PHPExcel_Style(FALSE, TRUE);
|
|
|
|
$style = new PHPExcel_Style(FALSE, TRUE);
|
|
|
@ -590,7 +590,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$dxfs[] = $style;
|
|
|
|
$dxfs[] = $style;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Cell Styles
|
|
|
|
// Cell Styles
|
|
|
|
if ($xmlStyles->cellStyles) {
|
|
|
|
if ($xmlStyles->cellStyles) {
|
|
|
|
foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
|
|
|
|
foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
|
|
|
|
if (intval($cellStyle['builtinId']) == 0) {
|
|
|
|
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
|
|
|
|
// Set base date
|
|
|
|
if ($xmlWorkbook->workbookPr) {
|
|
|
|
if ($xmlWorkbook->workbookPr) {
|
|
|
@ -643,13 +643,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
// Load sheet
|
|
|
|
// Load sheet
|
|
|
|
$docSheet = $excel->createSheet();
|
|
|
|
$docSheet = $excel->createSheet();
|
|
|
|
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet
|
|
|
|
// Use false for $updateFormulaCellReferences to prevent adjustment of worksheet
|
|
|
|
// references in formula cells... during the load, all formulae should be correct,
|
|
|
|
// 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
|
|
|
|
// and we're simply bringing the worksheet name in line with the formula, not the
|
|
|
|
// 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();
|
|
|
|
|
|
|
|
|
|
|
@ -666,10 +666,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) );
|
|
|
|
$docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($xmlSheet->sheetViews->sheetView['view'])) {
|
|
|
|
if (isset($xmlSheet->sheetViews->sheetView['view'])) {
|
|
|
|
$docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
|
|
|
|
$docSheet->getSheetView()->setView((string) $xmlSheet->sheetViews->sheetView['view']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) {
|
|
|
|
if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) {
|
|
|
|
$docSheet->setShowGridLines(self::boolean((string)$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'])) {
|
|
|
|
if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) {
|
|
|
|
$docSheet->getDefaultColumnDimension()->setWidth( (float)$xmlSheet->sheetFormatPr['defaultColWidth'] );
|
|
|
|
$docSheet->getDefaultColumnDimension()->setWidth( (float)$xmlSheet->sheetFormatPr['defaultColWidth'] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isset($xmlSheet->sheetFormatPr['zeroHeight']) &&
|
|
|
|
if (isset($xmlSheet->sheetFormatPr['zeroHeight']) &&
|
|
|
|
((string)$xmlSheet->sheetFormatPr['zeroHeight'] == '1')) {
|
|
|
|
((string)$xmlSheet->sheetFormatPr['zeroHeight'] == '1')) {
|
|
|
|
$docSheet->getDefaultRowDimension()->setzeroHeight(true);
|
|
|
|
$docSheet->getDefaultRowDimension()->setzeroHeight(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -864,11 +864,11 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
// Formula
|
|
|
|
// Formula
|
|
|
|
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool');
|
|
|
|
$this->_castToFormula($c,$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,'_castToBool');
|
|
|
|
if (isset($c->f['t'])) {
|
|
|
|
if (isset($c->f['t'])) {
|
|
|
|
$att = array();
|
|
|
|
$att = array();
|
|
|
|
$att = $c->f;
|
|
|
|
$att = $c->f;
|
|
|
|
$docSheet->getCell($r)->setFormulaAttributes($att);
|
|
|
|
$docSheet->getCell($r)->setFormulaAttributes($att);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// echo '$calculatedValue = '.$calculatedValue.'<br />';
|
|
|
|
// echo '$calculatedValue = '.$calculatedValue.'<br />';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
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");
|
|
|
|
$aKeys = array("sheet", "objects", "scenarios", "formatCells", "formatColumns", "formatRows", "insertColumns", "insertRows", "insertHyperlinks", "deleteColumns", "deleteRows", "selectLockedCells", "sort", "autoFilter", "pivotTables", "selectUnlockedCells");
|
|
|
|
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) {
|
|
|
|
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) {
|
|
|
|
foreach ($aKeys as $key) {
|
|
|
|
foreach ($aKeys as $key) {
|
|
|
@ -1004,111 +1004,111 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) {
|
|
|
|
if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) {
|
|
|
|
$autoFilter = $docSheet->getAutoFilter();
|
|
|
|
$autoFilter = $docSheet->getAutoFilter();
|
|
|
|
$autoFilter->setRange((string) $xmlSheet->autoFilter["ref"]);
|
|
|
|
$autoFilter->setRange((string) $xmlSheet->autoFilter["ref"]);
|
|
|
|
foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) {
|
|
|
|
foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) {
|
|
|
|
$column = $autoFilter->getColumnByOffset((integer) $filterColumn["colId"]);
|
|
|
|
$column = $autoFilter->getColumnByOffset((integer) $filterColumn["colId"]);
|
|
|
|
// Check for standard filters
|
|
|
|
// Check for standard filters
|
|
|
|
if ($filterColumn->filters) {
|
|
|
|
if ($filterColumn->filters) {
|
|
|
|
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER);
|
|
|
|
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_FILTER);
|
|
|
|
$filters = $filterColumn->filters;
|
|
|
|
$filters = $filterColumn->filters;
|
|
|
|
if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
|
|
|
|
if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
NULL, // Operator is undefined, but always treated as EQUAL
|
|
|
|
NULL, // Operator is undefined, but always treated as EQUAL
|
|
|
|
''
|
|
|
|
''
|
|
|
|
)
|
|
|
|
)
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Standard filters are always an OR join, so no join rule needs to be set
|
|
|
|
// Standard filters are always an OR join, so no join rule needs to be set
|
|
|
|
// Entries can be either filter elements
|
|
|
|
// Entries can be either filter elements
|
|
|
|
foreach ($filters->filter as $filterRule) {
|
|
|
|
foreach ($filters->filter as $filterRule) {
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
NULL, // Operator is undefined, but always treated as EQUAL
|
|
|
|
NULL, // Operator is undefined, but always treated as EQUAL
|
|
|
|
(string) $filterRule["val"]
|
|
|
|
(string) $filterRule["val"]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Or Date Group elements
|
|
|
|
// Or Date Group elements
|
|
|
|
foreach ($filters->dateGroupItem as $dateGroupItem) {
|
|
|
|
foreach ($filters->dateGroupItem as $dateGroupItem) {
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
NULL, // Operator is undefined, but always treated as EQUAL
|
|
|
|
NULL, // Operator is undefined, but always treated as EQUAL
|
|
|
|
array(
|
|
|
|
array(
|
|
|
|
'year' => (string) $dateGroupItem["year"],
|
|
|
|
'year' => (string) $dateGroupItem["year"],
|
|
|
|
'month' => (string) $dateGroupItem["month"],
|
|
|
|
'month' => (string) $dateGroupItem["month"],
|
|
|
|
'day' => (string) $dateGroupItem["day"],
|
|
|
|
'day' => (string) $dateGroupItem["day"],
|
|
|
|
'hour' => (string) $dateGroupItem["hour"],
|
|
|
|
'hour' => (string) $dateGroupItem["hour"],
|
|
|
|
'minute' => (string) $dateGroupItem["minute"],
|
|
|
|
'minute' => (string) $dateGroupItem["minute"],
|
|
|
|
'second' => (string) $dateGroupItem["second"],
|
|
|
|
'second' => (string) $dateGroupItem["second"],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(string) $dateGroupItem["dateTimeGrouping"]
|
|
|
|
(string) $dateGroupItem["dateTimeGrouping"]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check for custom filters
|
|
|
|
// Check for custom filters
|
|
|
|
if ($filterColumn->customFilters) {
|
|
|
|
if ($filterColumn->customFilters) {
|
|
|
|
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER);
|
|
|
|
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER);
|
|
|
|
$customFilters = $filterColumn->customFilters;
|
|
|
|
$customFilters = $filterColumn->customFilters;
|
|
|
|
// Custom filters can an AND or an OR join;
|
|
|
|
// Custom filters can an AND or an OR join;
|
|
|
|
// and there should only ever be one or two entries
|
|
|
|
// and there should only ever be one or two entries
|
|
|
|
if ((isset($customFilters["and"])) && ($customFilters["and"] == 1)) {
|
|
|
|
if ((isset($customFilters["and"])) && ($customFilters["and"] == 1)) {
|
|
|
|
$column->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
|
|
|
|
$column->setJoin(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach ($customFilters->customFilter as $filterRule) {
|
|
|
|
foreach ($customFilters->customFilter as $filterRule) {
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
(string) $filterRule["operator"],
|
|
|
|
(string) $filterRule["operator"],
|
|
|
|
(string) $filterRule["val"]
|
|
|
|
(string) $filterRule["val"]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_CUSTOMFILTER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check for dynamic filters
|
|
|
|
// Check for dynamic filters
|
|
|
|
if ($filterColumn->dynamicFilter) {
|
|
|
|
if ($filterColumn->dynamicFilter) {
|
|
|
|
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
|
|
|
|
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER);
|
|
|
|
// We should only ever have one dynamic filter
|
|
|
|
// We should only ever have one dynamic filter
|
|
|
|
foreach ($filterColumn->dynamicFilter as $filterRule) {
|
|
|
|
foreach ($filterColumn->dynamicFilter as $filterRule) {
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
NULL, // Operator is undefined, but always treated as EQUAL
|
|
|
|
NULL, // Operator is undefined, but always treated as EQUAL
|
|
|
|
(string) $filterRule["val"],
|
|
|
|
(string) $filterRule["val"],
|
|
|
|
(string) $filterRule["type"]
|
|
|
|
(string) $filterRule["type"]
|
|
|
|
)
|
|
|
|
)
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
|
|
|
if (isset($filterRule["val"])) {
|
|
|
|
if (isset($filterRule["val"])) {
|
|
|
|
$column->setAttribute('val',(string) $filterRule["val"]);
|
|
|
|
$column->setAttribute('val',(string) $filterRule["val"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isset($filterRule["maxVal"])) {
|
|
|
|
if (isset($filterRule["maxVal"])) {
|
|
|
|
$column->setAttribute('maxVal',(string) $filterRule["maxVal"]);
|
|
|
|
$column->setAttribute('maxVal',(string) $filterRule["maxVal"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Check for dynamic filters
|
|
|
|
// Check for dynamic filters
|
|
|
|
if ($filterColumn->top10) {
|
|
|
|
if ($filterColumn->top10) {
|
|
|
|
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER);
|
|
|
|
$column->setFilterType(PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_TOPTENFILTER);
|
|
|
|
// We should only ever have one top10 filter
|
|
|
|
// We should only ever have one top10 filter
|
|
|
|
foreach ($filterColumn->top10 as $filterRule) {
|
|
|
|
foreach ($filterColumn->top10 as $filterRule) {
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
$column->createRule()->setRule(
|
|
|
|
(((isset($filterRule["percent"])) && ($filterRule["percent"] == 1))
|
|
|
|
(((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_PERCENT
|
|
|
|
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE
|
|
|
|
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(string) $filterRule["val"],
|
|
|
|
(string) $filterRule["val"],
|
|
|
|
(((isset($filterRule["top"])) && ($filterRule["top"] == 1))
|
|
|
|
(((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_TOP
|
|
|
|
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
|
|
|
|
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER);
|
|
|
|
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_TOPTENFILTER);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) {
|
|
|
|
if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) {
|
|
|
|
foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) {
|
|
|
|
foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) {
|
|
|
|
$mergeRef = (string) $mergeCell["ref"];
|
|
|
|
$mergeRef = (string) $mergeCell["ref"];
|
|
|
|
if (strpos($mergeRef,':') !== FALSE) {
|
|
|
|
if (strpos($mergeRef,':') !== FALSE) {
|
|
|
|
$docSheet->mergeCells((string) $mergeCell["ref"]);
|
|
|
|
$docSheet->mergeCells((string) $mergeCell["ref"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -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) {
|
|
|
@ -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") {
|
|
|
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
|
|
|
|
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
|
|
|
|
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
|
|
|
|
} elseif ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart") {
|
|
|
|
} 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"],
|
|
|
|
$charts[self::dir_add($fileDrawing, $ele["Target"])] = array('id' => (string) $ele["Id"],
|
|
|
|
'sheet' => $docSheet->getTitle()
|
|
|
|
'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) {
|
|
|
|
if ($xmlDrawing->oneCellAnchor) {
|
|
|
|
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
|
|
|
|
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
|
|
|
@ -1479,7 +1479,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$objDrawing->setWorksheet($docSheet);
|
|
|
|
$objDrawing->setWorksheet($docSheet);
|
|
|
|
} else {
|
|
|
|
} 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);
|
|
|
|
$coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1);
|
|
|
|
$offsetX = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff);
|
|
|
|
$offsetX = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff);
|
|
|
|
$offsetY = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff);
|
|
|
|
$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);
|
|
|
|
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$objDrawing->setWorksheet($docSheet);
|
|
|
|
$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);
|
|
|
|
$fromCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1);
|
|
|
|
$fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff);
|
|
|
|
$fromOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff);
|
|
|
|
$fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
|
|
|
|
$fromOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff);
|
|
|
@ -1540,7 +1540,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
'toOffsetY' => $toOffsetY,
|
|
|
|
'toOffsetY' => $toOffsetY,
|
|
|
|
'worksheetTitle' => $docSheet->getTitle()
|
|
|
|
'worksheetTitle' => $docSheet->getTitle()
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1570,10 +1570,10 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
// Switch on type
|
|
|
|
// Switch on type
|
|
|
|
switch ((string)$definedName['name']) {
|
|
|
|
switch ((string)$definedName['name']) {
|
|
|
|
|
|
|
|
|
|
|
|
case '_xlnm._FilterDatabase':
|
|
|
|
case '_xlnm._FilterDatabase':
|
|
|
|
if ((string)$definedName['hidden'] !== '1') {
|
|
|
|
if ((string)$definedName['hidden'] !== '1') {
|
|
|
|
$docSheet->getAutoFilter()->setRange($extractedRange);
|
|
|
|
$docSheet->getAutoFilter()->setRange($extractedRange);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case '_xlnm.Print_Titles':
|
|
|
|
case '_xlnm.Print_Titles':
|
|
|
@ -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 />';
|
|
|
@ -1727,7 +1727,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
// echo 'Position Ref ',$chartPositionRef,'<br />';
|
|
|
|
// echo 'Position Ref ',$chartPositionRef,'<br />';
|
|
|
|
if (isset($chartDetails[$chartPositionRef])) {
|
|
|
|
if (isset($chartDetails[$chartPositionRef])) {
|
|
|
|
// var_dump($chartDetails[$chartPositionRef]);
|
|
|
|
// var_dump($chartDetails[$chartPositionRef]);
|
|
|
|
|
|
|
|
|
|
|
|
$excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart);
|
|
|
|
$excel->getSheetByName($charts[$chartEntryRef]['sheet'])->addChart($objChart);
|
|
|
|
$objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet']));
|
|
|
|
$objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef]['sheet']));
|
|
|
|
$objChart->setTopLeftPosition( $chartDetails[$chartPositionRef]['fromCoordinate'],
|
|
|
|
$objChart->setTopLeftPosition( $chartDetails[$chartPositionRef]['fromCoordinate'],
|
|
|
@ -1739,7 +1739,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$chartDetails[$chartPositionRef]['toOffsetY']
|
|
|
|
$chartDetails[$chartPositionRef]['toOffsetY']
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1749,7 +1749,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
|
|
|
|
|
|
|
|
return $excel;
|
|
|
|
return $excel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function _readColor($color, $background=FALSE) {
|
|
|
|
private static function _readColor($color, $background=FALSE) {
|
|
|
|
if (isset($color["rgb"])) {
|
|
|
|
if (isset($color["rgb"])) {
|
|
|
@ -1773,16 +1773,16 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
return 'FF000000';
|
|
|
|
return 'FF000000';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function _readStyle($docStyle, $style) {
|
|
|
|
private static function _readStyle($docStyle, $style) {
|
|
|
|
// format code
|
|
|
|
// format code
|
|
|
|
// if (isset($style->numFmt)) {
|
|
|
|
// if (isset($style->numFmt)) {
|
|
|
|
// if (isset($style->numFmt['formatCode'])) {
|
|
|
|
// if (isset($style->numFmt['formatCode'])) {
|
|
|
|
// $docStyle->getNumberFormat()->setFormatCode((string) $style->numFmt['formatCode']);
|
|
|
|
// $docStyle->getNumberFormat()->setFormatCode((string) $style->numFmt['formatCode']);
|
|
|
|
// } else {
|
|
|
|
// } else {
|
|
|
|
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
|
|
|
|
$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// font
|
|
|
|
// font
|
|
|
|
if (isset($style->font)) {
|
|
|
|
if (isset($style->font)) {
|
|
|
@ -1820,7 +1820,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
if (isset($style->fill)) {
|
|
|
|
if (isset($style->fill)) {
|
|
|
|
if ($style->fill->gradientFill) {
|
|
|
|
if ($style->fill->gradientFill) {
|
|
|
|
$gradientFill = $style->fill->gradientFill[0];
|
|
|
|
$gradientFill = $style->fill->gradientFill[0];
|
|
|
|
if(!empty($gradientFill["type"])) {
|
|
|
|
if(!empty($gradientFill["type"])) {
|
|
|
|
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
|
|
|
|
$docStyle->getFill()->setFillType((string) $gradientFill["type"]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
|
|
|
|
$docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
|
|
|
@ -1903,7 +1903,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
$docStyle->setQuotePrefix($style->quotePrefix);
|
|
|
|
$docStyle->setQuotePrefix($style->quotePrefix);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function _readBorder($docBorder, $eleBorder) {
|
|
|
|
private static function _readBorder($docBorder, $eleBorder) {
|
|
|
|
if (isset($eleBorder["style"])) {
|
|
|
|
if (isset($eleBorder["style"])) {
|
|
|
@ -1914,7 +1914,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function _parseRichText($is = null) {
|
|
|
|
private function _parseRichText($is = null) {
|
|
|
|
$value = new PHPExcel_RichText();
|
|
|
|
$value = new PHPExcel_RichText();
|
|
|
|
|
|
|
|
|
|
|
@ -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) {
|
|
|
@ -1998,7 +1998,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
|
|
|
// an image ?
|
|
|
|
// an image ?
|
|
|
|
$customUIImagesNames[(string) $ele['Id']] = (string)$ele['Target'];
|
|
|
|
$customUIImagesNames[(string) $ele['Id']] = (string)$ele['Target'];
|
|
|
|
$customUIImagesBinaries[(string)$ele['Target']] = $this->_getFromZipArchive($zip, $baseDir . '/' . (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);
|
|
|
|
return (isset($array[$key]) ? $array[$key] : null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function dir_add($base, $add) {
|
|
|
|
private static function dir_add($base, $add) {
|
|
|
|
return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
|
|
|
|
return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static function toCSSArray($style) {
|
|
|
|
private static function toCSSArray($style) {
|
|
|
|
$style = str_replace(array("\r","\n"), "", $style);
|
|
|
|
$style = str_replace(array("\r","\n"), "", $style);
|
|
|
|
|
|
|
|
|
|
|
|