PSR2 Fixes
This commit is contained in:
parent
9140e3da2e
commit
6b1764f771
|
@ -209,7 +209,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
|
|
||||||
$xml = new XMLReader();
|
$xml = new XMLReader();
|
||||||
$res = $xml->xml($this->securityScanFile('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet"), null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
$res = $xml->xml($this->securityScanFile('zip://'.PHPExcel_Shared_File::realpath($pFilename).'#'."$dir/$fileWorksheet"), null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
||||||
$xml->setParserProperty(2,true);
|
$xml->setParserProperty(2, true);
|
||||||
|
|
||||||
$currCells = 0;
|
$currCells = 0;
|
||||||
while ($xml->read()) {
|
while ($xml->read()) {
|
||||||
|
@ -265,7 +265,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
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;
|
||||||
|
@ -470,13 +470,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$macros = $customUI = null;
|
$macros = $customUI = null;
|
||||||
foreach ($relsWorkbook->Relationship as $ele) {
|
foreach ($relsWorkbook->Relationship as $ele) {
|
||||||
switch ($ele['Type']) {
|
switch ($ele['Type']) {
|
||||||
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet":
|
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet":
|
||||||
$worksheets[(string) $ele["Id"]] = $ele["Target"];
|
$worksheets[(string) $ele["Id"]] = $ele["Target"];
|
||||||
break;
|
break;
|
||||||
// a vbaProject ? (: some macros)
|
// a vbaProject ? (: some macros)
|
||||||
case "http://schemas.microsoft.com/office/2006/relationships/vbaProject":
|
case "http://schemas.microsoft.com/office/2006/relationships/vbaProject":
|
||||||
$macros = $ele["Target"];
|
$macros = $ele["Target"];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,7 +639,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// 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->securityScan($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
$xmlSheet = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
|
|
||||||
|
@ -886,9 +886,13 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
|
|
||||||
// Check for numeric values
|
// Check for numeric values
|
||||||
if (is_numeric($value) && $cellDataType != 's') {
|
if (is_numeric($value) && $cellDataType != 's') {
|
||||||
if ($value == (int)$value) $value = (int)$value;
|
if ($value == (int)$value) {
|
||||||
elseif ($value == (float)$value) $value = (float)$value;
|
$value = (int)$value;
|
||||||
elseif ($value == (double)$value) $value = (double)$value;
|
} elseif ($value == (float)$value) {
|
||||||
|
$value = (float)$value;
|
||||||
|
} elseif ($value == (double)$value) {
|
||||||
|
$value = (double)$value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rich text?
|
// Rich text?
|
||||||
|
@ -921,14 +925,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
|
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
|
||||||
foreach ($xmlSheet->conditionalFormatting as $conditional) {
|
foreach ($xmlSheet->conditionalFormatting as $conditional) {
|
||||||
foreach ($conditional->cfRule as $cfRule) {
|
foreach ($conditional->cfRule as $cfRule) {
|
||||||
if (
|
if (((string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || (string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) && isset($dxfs[intval($cfRule["dxfId"])])) {
|
||||||
(
|
|
||||||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE ||
|
|
||||||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS ||
|
|
||||||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT ||
|
|
||||||
(string)$cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_EXPRESSION
|
|
||||||
) && isset($dxfs[intval($cfRule["dxfId"])])
|
|
||||||
) {
|
|
||||||
$conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule;
|
$conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -996,7 +993,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$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);
|
||||||
|
@ -1005,7 +1002,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// 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);
|
||||||
|
@ -1013,7 +1010,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// 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"],
|
||||||
|
@ -1050,16 +1047,16 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// 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"]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1216,7 +1213,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->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorksheet = simplexml_load_string($this->securityScan($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"];
|
||||||
|
@ -1257,7 +1254,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->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorksheet = simplexml_load_string($this->securityScan($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"];
|
||||||
|
@ -1284,8 +1281,9 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
|
|
||||||
// Loop through contents
|
// Loop through contents
|
||||||
foreach ($commentsFile->commentList->comment as $comment) {
|
foreach ($commentsFile->commentList->comment as $comment) {
|
||||||
if (!empty($comment['authorId']))
|
if (!empty($comment['authorId'])) {
|
||||||
$docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]);
|
$docSheet->getComment((string)$comment['ref'])->setAuthor($authors[(string)$comment['authorId']]);
|
||||||
|
}
|
||||||
$docSheet->getComment((string)$comment['ref'])->setText($this->_parseRichText($comment->text));
|
$docSheet->getComment((string)$comment['ref'])->setText($this->_parseRichText($comment->text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1358,7 +1356,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->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorksheet = simplexml_load_string($this->securityScan($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) {
|
||||||
|
@ -1369,7 +1367,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->securityScan($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsVML = simplexml_load_string($this->securityScan($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") {
|
||||||
|
@ -1417,7 +1415,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->securityScan($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsWorksheet = simplexml_load_string($this->securityScan($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") {
|
||||||
|
@ -1427,7 +1425,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->securityScan($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions()); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
$relsDrawing = simplexml_load_string($this->securityScan($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) {
|
||||||
|
@ -1481,8 +1479,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$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);
|
||||||
$width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx"));
|
$width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx"));
|
||||||
$height = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy"));
|
$height = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1518,15 +1516,15 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
}
|
}
|
||||||
$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);
|
||||||
$toCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1);
|
$toCoordinate = PHPExcel_Cell::stringFromColumnIndex((string) $twoCellAnchor->to->col) . ($twoCellAnchor->to->row + 1);
|
||||||
$toOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->colOff);
|
$toOffsetX = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->colOff);
|
||||||
$toOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->rowOff);
|
$toOffsetY = PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->to->rowOff);
|
||||||
$graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic;
|
$graphic = $twoCellAnchor->graphicFrame->children("http://schemas.openxmlformats.org/drawingml/2006/main")->graphic;
|
||||||
$chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart;
|
$chartRef = $graphic->graphicData->children("http://schemas.openxmlformats.org/drawingml/2006/chart")->chart;
|
||||||
$thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
$thisChart = (string) $chartRef->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||||
|
|
||||||
$chartDetails[$docSheet->getTitle().'!'.$thisChart] = array(
|
$chartDetails[$docSheet->getTitle().'!'.$thisChart] = array(
|
||||||
'fromCoordinate' => $fromCoordinate,
|
'fromCoordinate' => $fromCoordinate,
|
||||||
|
@ -1551,7 +1549,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$extractedRange = (string)$definedName;
|
$extractedRange = (string)$definedName;
|
||||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||||
if (($spos = strpos($extractedRange, '!')) !== false) {
|
if (($spos = strpos($extractedRange, '!')) !== false) {
|
||||||
$extractedRange = substr($extractedRange,0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
$extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
||||||
} else {
|
} else {
|
||||||
$extractedRange = str_replace('$', '', $extractedRange);
|
$extractedRange = str_replace('$', '', $extractedRange);
|
||||||
}
|
}
|
||||||
|
@ -1588,9 +1586,8 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
// check for repeating columns, e g. 'A:A' or 'A:D'
|
// check for repeating columns, e g. 'A:A' or 'A:D'
|
||||||
if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
|
if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
|
||||||
$docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2]));
|
$docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2]));
|
||||||
}
|
} elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
|
||||||
// check for repeating rows, e.g. '1:1' or '1:5'
|
// check for repeating rows, e.g. '1:1' or '1:5'
|
||||||
elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
|
|
||||||
$docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2]));
|
$docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1627,7 +1624,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$extractedRange = (string)$definedName;
|
$extractedRange = (string)$definedName;
|
||||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||||
if (($spos = strpos($extractedRange, '!')) !== false) {
|
if (($spos = strpos($extractedRange, '!')) !== false) {
|
||||||
$extractedRange = substr($extractedRange,0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
$extractedRange = substr($extractedRange, 0, $spos).str_replace('$', '', substr($extractedRange, $spos));
|
||||||
} else {
|
} else {
|
||||||
$extractedRange = str_replace('$', '', $extractedRange);
|
$extractedRange = str_replace('$', '', $extractedRange);
|
||||||
}
|
}
|
||||||
|
@ -1700,7 +1697,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$excel->setActiveSheetIndex(0);
|
$excel->setActiveSheetIndex(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1712,7 +1709,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
if ($this->_includeCharts) {
|
if ($this->_includeCharts) {
|
||||||
$chartEntryRef = ltrim($contentType['PartName'], '/');
|
$chartEntryRef = ltrim($contentType['PartName'], '/');
|
||||||
$chartElements = simplexml_load_string($this->securityScan($this->_getFromZipArchive($zip, $chartEntryRef)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
$chartElements = simplexml_load_string($this->securityScan($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 />';
|
||||||
// var_dump($charts[$chartEntryRef]);
|
// var_dump($charts[$chartEntryRef]);
|
||||||
|
@ -1820,12 +1817,12 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid';
|
$patternType = (string)$style->fill->patternFill["patternType"] != '' ? (string)$style->fill->patternFill["patternType"] : 'solid';
|
||||||
$docStyle->getFill()->setFillType($patternType);
|
$docStyle->getFill()->setFillType($patternType);
|
||||||
if ($style->fill->patternFill->fgColor) {
|
if ($style->fill->patternFill->fgColor) {
|
||||||
$docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor,true));
|
$docStyle->getFill()->getStartColor()->setARGB(self::_readColor($style->fill->patternFill->fgColor, true));
|
||||||
} else {
|
} else {
|
||||||
$docStyle->getFill()->getStartColor()->setARGB('FF000000');
|
$docStyle->getFill()->getStartColor()->setARGB('FF000000');
|
||||||
}
|
}
|
||||||
if ($style->fill->patternFill->bgColor) {
|
if ($style->fill->patternFill->bgColor) {
|
||||||
$docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor,true));
|
$docStyle->getFill()->getEndColor()->setARGB(self::_readColor($style->fill->patternFill->bgColor, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,24 +34,24 @@
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Reader_Excel5_Escher
|
class PHPExcel_Reader_Excel5_Escher
|
||||||
{
|
{
|
||||||
const DGGCONTAINER = 0xF000;
|
const DGGCONTAINER = 0xF000;
|
||||||
const BSTORECONTAINER = 0xF001;
|
const BSTORECONTAINER = 0xF001;
|
||||||
const DGCONTAINER = 0xF002;
|
const DGCONTAINER = 0xF002;
|
||||||
const SPGRCONTAINER = 0xF003;
|
const SPGRCONTAINER = 0xF003;
|
||||||
const SPCONTAINER = 0xF004;
|
const SPCONTAINER = 0xF004;
|
||||||
const DGG = 0xF006;
|
const DGG = 0xF006;
|
||||||
const BSE = 0xF007;
|
const BSE = 0xF007;
|
||||||
const DG = 0xF008;
|
const DG = 0xF008;
|
||||||
const SPGR = 0xF009;
|
const SPGR = 0xF009;
|
||||||
const SP = 0xF00A;
|
const SP = 0xF00A;
|
||||||
const OPT = 0xF00B;
|
const OPT = 0xF00B;
|
||||||
const CLIENTTEXTBOX = 0xF00D;
|
const CLIENTTEXTBOX = 0xF00D;
|
||||||
const CLIENTANCHOR = 0xF010;
|
const CLIENTANCHOR = 0xF010;
|
||||||
const CLIENTDATA = 0xF011;
|
const CLIENTDATA = 0xF011;
|
||||||
const BLIPJPEG = 0xF01D;
|
const BLIPJPEG = 0xF01D;
|
||||||
const BLIPPNG = 0xF01E;
|
const BLIPPNG = 0xF01E;
|
||||||
const SPLITMENUCOLORS = 0xF11E;
|
const SPLITMENUCOLORS = 0xF11E;
|
||||||
const TERTIARYOPT = 0xF122;
|
const TERTIARYOPT = 0xF122;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Escher stream data (binary)
|
* Escher stream data (binary)
|
||||||
|
@ -112,25 +112,63 @@ class PHPExcel_Reader_Excel5_Escher
|
||||||
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
|
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
|
||||||
|
|
||||||
switch ($fbt) {
|
switch ($fbt) {
|
||||||
case self::DGGCONTAINER: $this->_readDggContainer(); break;
|
case self::DGGCONTAINER:
|
||||||
case self::DGG: $this->_readDgg(); break;
|
$this->_readDggContainer();
|
||||||
case self::BSTORECONTAINER: $this->_readBstoreContainer(); break;
|
break;
|
||||||
case self::BSE: $this->_readBSE(); break;
|
case self::DGG:
|
||||||
case self::BLIPJPEG: $this->_readBlipJPEG(); break;
|
$this->_readDgg();
|
||||||
case self::BLIPPNG: $this->_readBlipPNG(); break;
|
break;
|
||||||
case self::OPT: $this->_readOPT(); break;
|
case self::BSTORECONTAINER:
|
||||||
case self::TERTIARYOPT: $this->_readTertiaryOPT(); break;
|
$this->_readBstoreContainer();
|
||||||
case self::SPLITMENUCOLORS: $this->_readSplitMenuColors(); break;
|
break;
|
||||||
case self::DGCONTAINER: $this->_readDgContainer(); break;
|
case self::BSE:
|
||||||
case self::DG: $this->_readDg(); break;
|
$this->_readBSE();
|
||||||
case self::SPGRCONTAINER: $this->_readSpgrContainer(); break;
|
break;
|
||||||
case self::SPCONTAINER: $this->_readSpContainer(); break;
|
case self::BLIPJPEG:
|
||||||
case self::SPGR: $this->_readSpgr(); break;
|
$this->_readBlipJPEG();
|
||||||
case self::SP: $this->_readSp(); break;
|
break;
|
||||||
case self::CLIENTTEXTBOX: $this->_readClientTextbox(); break;
|
case self::BLIPPNG:
|
||||||
case self::CLIENTANCHOR: $this->_readClientAnchor(); break;
|
$this->_readBlipPNG();
|
||||||
case self::CLIENTDATA: $this->_readClientData(); break;
|
break;
|
||||||
default: $this->_readDefault(); break;
|
case self::OPT:
|
||||||
|
$this->_readOPT();
|
||||||
|
break;
|
||||||
|
case self::TERTIARYOPT:
|
||||||
|
$this->_readTertiaryOPT();
|
||||||
|
break;
|
||||||
|
case self::SPLITMENUCOLORS:
|
||||||
|
$this->_readSplitMenuColors();
|
||||||
|
break;
|
||||||
|
case self::DGCONTAINER:
|
||||||
|
$this->_readDgContainer();
|
||||||
|
break;
|
||||||
|
case self::DG:
|
||||||
|
$this->_readDg();
|
||||||
|
break;
|
||||||
|
case self::SPGRCONTAINER:
|
||||||
|
$this->_readSpgrContainer();
|
||||||
|
break;
|
||||||
|
case self::SPCONTAINER:
|
||||||
|
$this->_readSpContainer();
|
||||||
|
break;
|
||||||
|
case self::SPGR:
|
||||||
|
$this->_readSpgr();
|
||||||
|
break;
|
||||||
|
case self::SP:
|
||||||
|
$this->_readSp();
|
||||||
|
break;
|
||||||
|
case self::CLIENTTEXTBOX:
|
||||||
|
$this->_readClientTextbox();
|
||||||
|
break;
|
||||||
|
case self::CLIENTANCHOR:
|
||||||
|
$this->_readClientAnchor();
|
||||||
|
break;
|
||||||
|
case self::CLIENTDATA:
|
||||||
|
$this->_readClientData();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$this->_readDefault();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -598,8 +636,8 @@ class PHPExcel_Reader_Excel5_Escher
|
||||||
* @param string $data Binary data
|
* @param string $data Binary data
|
||||||
* @param int $n Number of properties
|
* @param int $n Number of properties
|
||||||
*/
|
*/
|
||||||
private function _readOfficeArtRGFOPTE($data, $n) {
|
private function _readOfficeArtRGFOPTE($data, $n)
|
||||||
|
{
|
||||||
$splicedComplexData = substr($data, 6 * $n);
|
$splicedComplexData = substr($data, 6 * $n);
|
||||||
|
|
||||||
// loop through property-value pairs
|
// loop through property-value pairs
|
||||||
|
@ -636,5 +674,4 @@ class PHPExcel_Reader_Excel5_Escher
|
||||||
$this->_object->setOPT($opidOpid, $value);
|
$this->_object->setOPT($opidOpid, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
private $c;
|
private $c;
|
||||||
private $d;
|
private $d;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MD5 stream constructor
|
* MD5 stream constructor
|
||||||
*/
|
*/
|
||||||
|
@ -50,7 +49,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
$this->reset();
|
$this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the MD5 stream context
|
* Reset the MD5 stream context
|
||||||
*/
|
*/
|
||||||
|
@ -62,7 +60,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
$this->d = 0x10325476;
|
$this->d = 0x10325476;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get MD5 stream context
|
* Get MD5 stream context
|
||||||
*
|
*
|
||||||
|
@ -82,7 +79,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add data to context
|
* Add data to context
|
||||||
*
|
*
|
||||||
|
@ -180,31 +176,26 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
$this->d = ($this->d + $D) & 0xffffffff;
|
$this->d = ($this->d + $D) & 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function F($X, $Y, $Z)
|
private static function F($X, $Y, $Z)
|
||||||
{
|
{
|
||||||
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
|
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function G($X, $Y, $Z)
|
private static function G($X, $Y, $Z)
|
||||||
{
|
{
|
||||||
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
|
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function H($X, $Y, $Z)
|
private static function H($X, $Y, $Z)
|
||||||
{
|
{
|
||||||
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
|
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function I($X, $Y, $Z)
|
private static function I($X, $Y, $Z)
|
||||||
{
|
{
|
||||||
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
|
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
|
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
|
||||||
{
|
{
|
||||||
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
|
$A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
|
||||||
|
@ -212,7 +203,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||||
$A = ($B + $A) & 0xffffffff;
|
$A = ($B + $A) & 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function rotate($decimal, $bits)
|
private static function rotate($decimal, $bits)
|
||||||
{
|
{
|
||||||
$binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);
|
$binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);
|
||||||
|
|
|
@ -92,16 +92,16 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
// Count delimiters in file
|
// Count delimiters in file
|
||||||
$delimiterCount = substr_count($data, ';');
|
$delimiterCount = substr_count($data, ';');
|
||||||
if ($delimiterCount < 1) {
|
if ($delimiterCount < 1) {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Analyze first line looking for ID; signature
|
// Analyze first line looking for ID; signature
|
||||||
$lines = explode("\n", $data);
|
$lines = explode("\n", $data);
|
||||||
if (substr($lines[0],0,4) != 'ID;P') {
|
if (substr($lines[0],0,4) != 'ID;P') {
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,7 +154,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
|
|
||||||
// loop through one row (line) at a time in the file
|
// loop through one row (line) at a time in the file
|
||||||
$rowIndex = 0;
|
$rowIndex = 0;
|
||||||
while (($rowData = fgets($fileHandle)) !== FALSE) {
|
while (($rowData = fgets($fileHandle)) !== false) {
|
||||||
$columnIndex = 0;
|
$columnIndex = 0;
|
||||||
|
|
||||||
// convert SYLK encoded $rowData to UTF-8
|
// convert SYLK encoded $rowData to UTF-8
|
||||||
|
@ -243,7 +243,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
$column = $row = '';
|
$column = $row = '';
|
||||||
|
|
||||||
// loop through one row (line) at a time in the file
|
// loop through one row (line) at a time in the file
|
||||||
while (($rowData = fgets($fileHandle)) !== FALSE) {
|
while (($rowData = fgets($fileHandle)) !== false) {
|
||||||
|
|
||||||
// convert SYLK encoded $rowData to UTF-8
|
// convert SYLK encoded $rowData to UTF-8
|
||||||
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
|
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
|
||||||
|
@ -258,31 +258,41 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
$formatArray = array();
|
$formatArray = array();
|
||||||
foreach ($rowData as $rowDatum) {
|
foreach ($rowData as $rowDatum) {
|
||||||
switch ($rowDatum{0}) {
|
switch ($rowDatum{0}) {
|
||||||
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats,substr($rowDatum,1));
|
case 'P':
|
||||||
break;
|
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
|
||||||
case 'E' :
|
break;
|
||||||
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1);
|
case 'E':
|
||||||
break;
|
case 'F':
|
||||||
case 'L' : $formatArray['font']['size'] = substr($rowDatum,1);
|
$formatArray['font']['name'] = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'S' : $styleSettings = substr($rowDatum,1);
|
case 'L':
|
||||||
for ($i=0;$i<strlen($styleSettings);++$i) {
|
$formatArray['font']['size'] = substr($rowDatum, 1);
|
||||||
switch ($styleSettings{$i}) {
|
break;
|
||||||
case 'I' : $formatArray['font']['italic'] = true;
|
case 'S':
|
||||||
break;
|
$styleSettings = substr($rowDatum,1);
|
||||||
case 'D' : $formatArray['font']['bold'] = true;
|
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||||
break;
|
switch ($styleSettings{$i}) {
|
||||||
case 'T' : $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'I':
|
||||||
break;
|
$formatArray['font']['italic'] = true;
|
||||||
case 'B' : $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
break;
|
||||||
break;
|
case 'D':
|
||||||
case 'L' : $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$formatArray['font']['bold'] = true;
|
||||||
break;
|
break;
|
||||||
case 'R' : $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'T':
|
||||||
break;
|
$formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
}
|
break;
|
||||||
}
|
case 'B':
|
||||||
break;
|
$formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'L':
|
||||||
|
$formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'R':
|
||||||
|
$formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_formats['P'.$this->_format++] = $formatArray;
|
$this->_formats['P'.$this->_format++] = $formatArray;
|
||||||
|
@ -292,50 +302,62 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
$cellData = $cellDataFormula = '';
|
$cellData = $cellDataFormula = '';
|
||||||
foreach ($rowData as $rowDatum) {
|
foreach ($rowData as $rowDatum) {
|
||||||
switch ($rowDatum{0}) {
|
switch ($rowDatum{0}) {
|
||||||
case 'C' :
|
case 'C':
|
||||||
case 'X' : $column = substr($rowDatum,1);
|
case 'X':
|
||||||
break;
|
$column = substr($rowDatum, 1);
|
||||||
case 'R' :
|
break;
|
||||||
case 'Y' : $row = substr($rowDatum,1);
|
case 'R':
|
||||||
break;
|
case 'Y':
|
||||||
case 'K' : $cellData = substr($rowDatum,1);
|
$row = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'E' : $cellDataFormula = '='.substr($rowDatum,1);
|
case 'K':
|
||||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
$cellData = substr($rowDatum, 1);
|
||||||
$temp = explode('"', $cellDataFormula);
|
break;
|
||||||
$key = false;
|
case 'E':
|
||||||
foreach ($temp as &$value) {
|
$cellDataFormula = '='.substr($rowDatum, 1);
|
||||||
// Only count/replace in alternate array entries
|
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||||
if ($key = !$key) {
|
$temp = explode('"', $cellDataFormula);
|
||||||
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
$key = false;
|
||||||
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
foreach ($temp as &$value) {
|
||||||
// through the formula from left to right. Reversing means that we work right to left.through
|
// Only count/replace in alternate array entries
|
||||||
// the formula
|
if ($key = !$key) {
|
||||||
$cellReferences = array_reverse($cellReferences);
|
preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences,PREG_SET_ORDER+PREG_OFFSET_CAPTURE);
|
||||||
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
// Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
|
||||||
// then modify the formula to use that new reference
|
// through the formula from left to right. Reversing means that we work right to left.through
|
||||||
foreach ($cellReferences as $cellReference) {
|
// the formula
|
||||||
$rowReference = $cellReference[2][0];
|
$cellReferences = array_reverse($cellReferences);
|
||||||
// Empty R reference is the current row
|
// Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
|
||||||
if ($rowReference == '') $rowReference = $row;
|
// then modify the formula to use that new reference
|
||||||
// Bracketed R references are relative to the current row
|
foreach ($cellReferences as $cellReference) {
|
||||||
if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]');
|
$rowReference = $cellReference[2][0];
|
||||||
$columnReference = $cellReference[4][0];
|
// Empty R reference is the current row
|
||||||
// Empty C reference is the current column
|
if ($rowReference == '') {
|
||||||
if ($columnReference == '') $columnReference = $column;
|
$rowReference = $row;
|
||||||
// Bracketed C references are relative to the current column
|
|
||||||
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]');
|
|
||||||
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
|
||||||
|
|
||||||
$value = substr_replace($value, $A1CellReference, $cellReference[0][1],strlen($cellReference[0][0]));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// Bracketed R references are relative to the current row
|
||||||
|
if ($rowReference{0} == '[') {
|
||||||
|
$rowReference = $row + trim($rowReference, '[]');
|
||||||
|
}
|
||||||
|
$columnReference = $cellReference[4][0];
|
||||||
|
// Empty C reference is the current column
|
||||||
|
if ($columnReference == '') {
|
||||||
|
$columnReference = $column;
|
||||||
|
}
|
||||||
|
// Bracketed C references are relative to the current column
|
||||||
|
if ($columnReference{0} == '[') {
|
||||||
|
$columnReference = $column + trim($columnReference,'[]');
|
||||||
|
}
|
||||||
|
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||||
|
|
||||||
|
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
|
||||||
}
|
}
|
||||||
unset($value);
|
}
|
||||||
// Then rebuild the formula string
|
}
|
||||||
$cellDataFormula = implode('"', $temp);
|
unset($value);
|
||||||
$hasCalculatedValue = true;
|
// Then rebuild the formula string
|
||||||
break;
|
$cellDataFormula = implode('"', $temp);
|
||||||
|
$hasCalculatedValue = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||||
|
@ -353,34 +375,45 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
$styleData = array();
|
$styleData = array();
|
||||||
foreach ($rowData as $rowDatum) {
|
foreach ($rowData as $rowDatum) {
|
||||||
switch ($rowDatum{0}) {
|
switch ($rowDatum{0}) {
|
||||||
case 'C' :
|
case 'C':
|
||||||
case 'X' : $column = substr($rowDatum,1);
|
case 'X':
|
||||||
break;
|
$column = substr($rowDatum, 1);
|
||||||
case 'R' :
|
break;
|
||||||
case 'Y' : $row = substr($rowDatum,1);
|
case 'R':
|
||||||
break;
|
case 'Y':
|
||||||
case 'P' : $formatStyle = $rowDatum;
|
$row = substr($rowDatum, 1);
|
||||||
break;
|
break;
|
||||||
case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ',substr($rowDatum,1));
|
case 'P':
|
||||||
break;
|
$formatStyle = $rowDatum;
|
||||||
case 'S' : $styleSettings = substr($rowDatum,1);
|
break;
|
||||||
for ($i=0;$i<strlen($styleSettings);++$i) {
|
case 'W':
|
||||||
switch ($styleSettings{$i}) {
|
list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
|
||||||
case 'I' : $styleData['font']['italic'] = true;
|
break;
|
||||||
break;
|
case 'S':
|
||||||
case 'D' : $styleData['font']['bold'] = true;
|
$styleSettings = substr($rowDatum,1);
|
||||||
break;
|
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||||
case 'T' : $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
switch ($styleSettings{$i}) {
|
||||||
break;
|
case 'I':
|
||||||
case 'B' : $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$styleData['font']['italic'] = true;
|
||||||
break;
|
break;
|
||||||
case 'L' : $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
case 'D':
|
||||||
break;
|
$styleData['font']['bold'] = true;
|
||||||
case 'R' : $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
break;
|
||||||
break;
|
case 'T':
|
||||||
}
|
$styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
}
|
break;
|
||||||
break;
|
case 'B':
|
||||||
|
$styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'L':
|
||||||
|
$styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
case 'R':
|
||||||
|
$styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($formatStyle > '') && ($column > '') && ($row > '')) {
|
if (($formatStyle > '') && ($column > '') && ($row > '')) {
|
||||||
|
@ -409,12 +442,14 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
} else {
|
} else {
|
||||||
foreach ($rowData as $rowDatum) {
|
foreach ($rowData as $rowDatum) {
|
||||||
switch ($rowDatum{0}) {
|
switch ($rowDatum{0}) {
|
||||||
case 'C' :
|
case 'C':
|
||||||
case 'X' : $column = substr($rowDatum,1);
|
case 'X':
|
||||||
break;
|
$column = substr($rowDatum,1);
|
||||||
case 'R' :
|
break;
|
||||||
case 'Y' : $row = substr($rowDatum,1);
|
case 'R':
|
||||||
break;
|
case 'Y':
|
||||||
|
$row = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -432,7 +467,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getSheetIndex() {
|
public function getSheetIndex()
|
||||||
|
{
|
||||||
return $this->_sheetIndex;
|
return $this->_sheetIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,9 +478,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||||
* @param int $pValue Sheet index
|
* @param int $pValue Sheet index
|
||||||
* @return PHPExcel_Reader_SYLK
|
* @return PHPExcel_Reader_SYLK
|
||||||
*/
|
*/
|
||||||
public function setSheetIndex($pValue = 0) {
|
public function setSheetIndex($pValue = 0)
|
||||||
|
{
|
||||||
$this->_sheetIndex = $pValue;
|
$this->_sheetIndex = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,7 +662,7 @@ class PHPExcel_ReferenceHelper
|
||||||
$toString .= $modified3.':'.$modified4;
|
$toString .= $modified3.':'.$modified4;
|
||||||
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
// Max worksheet size is 1,048,576 rows by 16,384 columns in Excel 2007, so our adjustments need to be at least one digit more
|
||||||
$column = 100000;
|
$column = 100000;
|
||||||
$row = 10000000 + trim($match[3],'$');
|
$row = 10000000 + trim($match[3], '$');
|
||||||
$cellIndex = $column.$row;
|
$cellIndex = $column.$row;
|
||||||
|
|
||||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||||
|
|
Loading…
Reference in New Issue