mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-25 23:06:03 +03:00
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();
|
||||
$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;
|
||||
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;
|
||||
} // 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 '$c->f is ', $c->f, PHP_EOL;
|
||||
@ -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,
|
||||
// and we're simply bringing the worksheet name in line with the formula, not the
|
||||
// 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")];
|
||||
$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
|
||||
if (is_numeric($value) && $cellDataType != 's') {
|
||||
if ($value == (int)$value) $value = (int)$value;
|
||||
elseif ($value == (float)$value) $value = (float)$value;
|
||||
elseif ($value == (double)$value) $value = (double)$value;
|
||||
if ($value == (int)$value) {
|
||||
$value = (int)$value;
|
||||
} elseif ($value == (float)$value) {
|
||||
$value = (float)$value;
|
||||
} elseif ($value == (double)$value) {
|
||||
$value = (double)$value;
|
||||
}
|
||||
}
|
||||
|
||||
// Rich text?
|
||||
@ -921,14 +925,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
|
||||
foreach ($xmlSheet->conditionalFormatting as $conditional) {
|
||||
foreach ($conditional->cfRule as $cfRule) {
|
||||
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"])])
|
||||
) {
|
||||
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"])])) {
|
||||
$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;
|
||||
if ((isset($filters["blank"])) && ($filters["blank"] == 1)) {
|
||||
$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);
|
||||
@ -1005,7 +1002,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
// Entries can be either filter elements
|
||||
foreach ($filters->filter as $filterRule) {
|
||||
$column->createRule()->setRule(
|
||||
null, // Operator is undefined, but always treated as EQUAL
|
||||
null,// Operator is undefined, but always treated as EQUAL
|
||||
(string) $filterRule["val"]
|
||||
)
|
||||
->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
|
||||
foreach ($filters->dateGroupItem as $dateGroupItem) {
|
||||
$column->createRule()->setRule(
|
||||
null, // Operator is undefined, but always treated as EQUAL
|
||||
null,// Operator is undefined, but always treated as EQUAL
|
||||
array(
|
||||
'year' => (string) $dateGroupItem["year"],
|
||||
'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
|
||||
foreach ($filterColumn->dynamicFilter as $filterRule) {
|
||||
$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["type"]
|
||||
)
|
||||
->setRuleType(PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER);
|
||||
if (isset($filterRule["val"])) {
|
||||
$column->setAttribute('val',(string) $filterRule["val"]);
|
||||
$column->setAttribute('val', (string) $filterRule["val"]);
|
||||
}
|
||||
if (isset($filterRule["maxVal"])) {
|
||||
$column->setAttribute('maxVal',(string) $filterRule["maxVal"]);
|
||||
$column->setAttribute('maxVal', (string) $filterRule["maxVal"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1284,8 +1281,9 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
|
||||
// Loop through contents
|
||||
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'])->setText($this->_parseRichText($comment->text));
|
||||
}
|
||||
}
|
||||
@ -1551,7 +1549,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
$extractedRange = (string)$definedName;
|
||||
$extractedRange = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||
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 {
|
||||
$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'
|
||||
if (preg_match('/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
|
||||
$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'
|
||||
elseif (preg_match('/!?(\d+)\:(\d+)$/', $range, $matches)) {
|
||||
$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 = preg_replace('/\'(\w+)\'\!/', '', $extractedRange);
|
||||
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 {
|
||||
$extractedRange = str_replace('$', '', $extractedRange);
|
||||
}
|
||||
@ -1712,7 +1709,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||
if ($this->_includeCharts) {
|
||||
$chartEntryRef = ltrim($contentType['PartName'], '/');
|
||||
$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 />';
|
||||
// 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';
|
||||
$docStyle->getFill()->setFillType($patternType);
|
||||
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 {
|
||||
$docStyle->getFill()->getStartColor()->setARGB('FF000000');
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,25 +112,63 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
$fbt = PHPExcel_Reader_Excel5::_GetInt2d($this->_data, $this->_pos + 2);
|
||||
|
||||
switch ($fbt) {
|
||||
case self::DGGCONTAINER: $this->_readDggContainer(); break;
|
||||
case self::DGG: $this->_readDgg(); break;
|
||||
case self::BSTORECONTAINER: $this->_readBstoreContainer(); break;
|
||||
case self::BSE: $this->_readBSE(); break;
|
||||
case self::BLIPJPEG: $this->_readBlipJPEG(); break;
|
||||
case self::BLIPPNG: $this->_readBlipPNG(); 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;
|
||||
case self::DGGCONTAINER:
|
||||
$this->_readDggContainer();
|
||||
break;
|
||||
case self::DGG:
|
||||
$this->_readDgg();
|
||||
break;
|
||||
case self::BSTORECONTAINER:
|
||||
$this->_readBstoreContainer();
|
||||
break;
|
||||
case self::BSE:
|
||||
$this->_readBSE();
|
||||
break;
|
||||
case self::BLIPJPEG:
|
||||
$this->_readBlipJPEG();
|
||||
break;
|
||||
case self::BLIPPNG:
|
||||
$this->_readBlipPNG();
|
||||
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 int $n Number of properties
|
||||
*/
|
||||
private function _readOfficeArtRGFOPTE($data, $n) {
|
||||
|
||||
private function _readOfficeArtRGFOPTE($data, $n)
|
||||
{
|
||||
$splicedComplexData = substr($data, 6 * $n);
|
||||
|
||||
// loop through property-value pairs
|
||||
@ -636,5 +674,4 @@ class PHPExcel_Reader_Excel5_Escher
|
||||
$this->_object->setOPT($opidOpid, $value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||
private $c;
|
||||
private $d;
|
||||
|
||||
|
||||
/**
|
||||
* MD5 stream constructor
|
||||
*/
|
||||
@ -50,7 +49,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||
$this->reset();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Reset the MD5 stream context
|
||||
*/
|
||||
@ -62,7 +60,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||
$this->d = 0x10325476;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get MD5 stream context
|
||||
*
|
||||
@ -82,7 +79,6 @@ class PHPExcel_Reader_Excel5_MD5
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add data to context
|
||||
*
|
||||
@ -180,31 +176,26 @@ class PHPExcel_Reader_Excel5_MD5
|
||||
$this->d = ($this->d + $D) & 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
private static function F($X, $Y, $Z)
|
||||
{
|
||||
return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
|
||||
}
|
||||
|
||||
|
||||
private static function G($X, $Y, $Z)
|
||||
{
|
||||
return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
|
||||
}
|
||||
|
||||
|
||||
private static function H($X, $Y, $Z)
|
||||
{
|
||||
return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
|
||||
}
|
||||
|
||||
|
||||
private static function I($X, $Y, $Z)
|
||||
{
|
||||
return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
|
||||
}
|
||||
|
||||
|
||||
private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
private static function rotate($decimal, $bits)
|
||||
{
|
||||
$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
|
||||
$delimiterCount = substr_count($data, ';');
|
||||
if ($delimiterCount < 1) {
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Analyze first line looking for ID; signature
|
||||
$lines = explode("\n", $data);
|
||||
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
|
||||
$rowIndex = 0;
|
||||
while (($rowData = fgets($fileHandle)) !== FALSE) {
|
||||
while (($rowData = fgets($fileHandle)) !== false) {
|
||||
$columnIndex = 0;
|
||||
|
||||
// convert SYLK encoded $rowData to UTF-8
|
||||
@ -243,7 +243,7 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
$column = $row = '';
|
||||
|
||||
// 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
|
||||
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
|
||||
@ -258,27 +258,37 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
$formatArray = array();
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'P' : $formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats,substr($rowDatum,1));
|
||||
case 'P':
|
||||
$formatArray['numberformat']['code'] = str_replace($fromFormats, $toFormats, substr($rowDatum, 1));
|
||||
break;
|
||||
case 'E' :
|
||||
case 'F' : $formatArray['font']['name'] = substr($rowDatum,1);
|
||||
case 'E':
|
||||
case 'F':
|
||||
$formatArray['font']['name'] = substr($rowDatum, 1);
|
||||
break;
|
||||
case 'L' : $formatArray['font']['size'] = substr($rowDatum,1);
|
||||
case 'L':
|
||||
$formatArray['font']['size'] = substr($rowDatum, 1);
|
||||
break;
|
||||
case 'S' : $styleSettings = substr($rowDatum,1);
|
||||
case 'S':
|
||||
$styleSettings = substr($rowDatum,1);
|
||||
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||
switch ($styleSettings{$i}) {
|
||||
case 'I' : $formatArray['font']['italic'] = true;
|
||||
case 'I':
|
||||
$formatArray['font']['italic'] = true;
|
||||
break;
|
||||
case 'D' : $formatArray['font']['bold'] = true;
|
||||
case 'D':
|
||||
$formatArray['font']['bold'] = true;
|
||||
break;
|
||||
case 'T' : $formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
case 'T':
|
||||
$formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
case 'B' : $formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
case 'B':
|
||||
$formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
case 'L' : $formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
case 'L':
|
||||
$formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
case 'R' : $formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
case 'R':
|
||||
$formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -292,15 +302,19 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
$cellData = $cellDataFormula = '';
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
case 'C':
|
||||
case 'X':
|
||||
$column = substr($rowDatum, 1);
|
||||
break;
|
||||
case 'R' :
|
||||
case 'Y' : $row = substr($rowDatum,1);
|
||||
case 'R':
|
||||
case 'Y':
|
||||
$row = substr($rowDatum, 1);
|
||||
break;
|
||||
case 'K' : $cellData = substr($rowDatum,1);
|
||||
case 'K':
|
||||
$cellData = substr($rowDatum, 1);
|
||||
break;
|
||||
case 'E' : $cellDataFormula = '='.substr($rowDatum,1);
|
||||
case 'E':
|
||||
$cellDataFormula = '='.substr($rowDatum, 1);
|
||||
// Convert R1C1 style references to A1 style references (but only when not quoted)
|
||||
$temp = explode('"', $cellDataFormula);
|
||||
$key = false;
|
||||
@ -317,17 +331,25 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
foreach ($cellReferences as $cellReference) {
|
||||
$rowReference = $cellReference[2][0];
|
||||
// Empty R reference is the current row
|
||||
if ($rowReference == '') $rowReference = $row;
|
||||
if ($rowReference == '') {
|
||||
$rowReference = $row;
|
||||
}
|
||||
// Bracketed R references are relative to the current row
|
||||
if ($rowReference{0} == '[') $rowReference = $row + trim($rowReference,'[]');
|
||||
if ($rowReference{0} == '[') {
|
||||
$rowReference = $row + trim($rowReference, '[]');
|
||||
}
|
||||
$columnReference = $cellReference[4][0];
|
||||
// Empty C reference is the current column
|
||||
if ($columnReference == '') $columnReference = $column;
|
||||
if ($columnReference == '') {
|
||||
$columnReference = $column;
|
||||
}
|
||||
// Bracketed C references are relative to the current column
|
||||
if ($columnReference{0} == '[') $columnReference = $column + trim($columnReference,'[]');
|
||||
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]));
|
||||
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -353,30 +375,41 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
$styleData = array();
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
case 'C':
|
||||
case 'X':
|
||||
$column = substr($rowDatum, 1);
|
||||
break;
|
||||
case 'R' :
|
||||
case 'Y' : $row = substr($rowDatum,1);
|
||||
case 'R':
|
||||
case 'Y':
|
||||
$row = substr($rowDatum, 1);
|
||||
break;
|
||||
case 'P' : $formatStyle = $rowDatum;
|
||||
case 'P':
|
||||
$formatStyle = $rowDatum;
|
||||
break;
|
||||
case 'W' : list($startCol, $endCol, $columnWidth) = explode(' ',substr($rowDatum,1));
|
||||
case 'W':
|
||||
list($startCol, $endCol, $columnWidth) = explode(' ', substr($rowDatum, 1));
|
||||
break;
|
||||
case 'S' : $styleSettings = substr($rowDatum,1);
|
||||
case 'S':
|
||||
$styleSettings = substr($rowDatum,1);
|
||||
for ($i=0;$i<strlen($styleSettings);++$i) {
|
||||
switch ($styleSettings{$i}) {
|
||||
case 'I' : $styleData['font']['italic'] = true;
|
||||
case 'I':
|
||||
$styleData['font']['italic'] = true;
|
||||
break;
|
||||
case 'D' : $styleData['font']['bold'] = true;
|
||||
case 'D':
|
||||
$styleData['font']['bold'] = true;
|
||||
break;
|
||||
case 'T' : $styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
case 'T':
|
||||
$styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
case 'B' : $styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
case 'B':
|
||||
$styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
case 'L' : $styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
case 'L':
|
||||
$styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
case 'R' : $styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
case 'R':
|
||||
$styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -409,11 +442,13 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
} else {
|
||||
foreach ($rowData as $rowDatum) {
|
||||
switch ($rowDatum{0}) {
|
||||
case 'C' :
|
||||
case 'X' : $column = substr($rowDatum,1);
|
||||
case 'C':
|
||||
case 'X':
|
||||
$column = substr($rowDatum,1);
|
||||
break;
|
||||
case 'R' :
|
||||
case 'Y' : $row = substr($rowDatum,1);
|
||||
case 'R':
|
||||
case 'Y':
|
||||
$row = substr($rowDatum,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -432,7 +467,8 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSheetIndex() {
|
||||
public function getSheetIndex()
|
||||
{
|
||||
return $this->_sheetIndex;
|
||||
}
|
||||
|
||||
@ -442,9 +478,9 @@ class PHPExcel_Reader_SYLK extends PHPExcel_Reader_Abstract implements PHPExcel_
|
||||
* @param int $pValue Sheet index
|
||||
* @return PHPExcel_Reader_SYLK
|
||||
*/
|
||||
public function setSheetIndex($pValue = 0) {
|
||||
public function setSheetIndex($pValue = 0)
|
||||
{
|
||||
$this->_sheetIndex = $pValue;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ class PHPExcel_ReferenceHelper
|
||||
$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
|
||||
$column = 100000;
|
||||
$row = 10000000 + trim($match[3],'$');
|
||||
$row = 10000000 + trim($match[3], '$');
|
||||
$cellIndex = $column.$row;
|
||||
|
||||
$newCellTokens[$cellIndex] = preg_quote($toString);
|
||||
|
Loading…
Reference in New Issue
Block a user