|
|
|
@ -1988,7 +1988,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// offset: 10; size: 1; underline type |
|
|
|
|
$underlineType = ord($recordData{10}); |
|
|
|
|
$underlineType = ord($recordData[10]); |
|
|
|
|
switch ($underlineType) { |
|
|
|
|
case 0x00: |
|
|
|
|
break; // no underline |
|
|
|
@ -2125,7 +2125,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
|
|
|
|
|
// offset: 6; size: 1; Alignment and text break |
|
|
|
|
// bit 2-0, mask 0x07; horizontal alignment |
|
|
|
|
$horAlign = (0x07 & ord($recordData{6})) >> 0; |
|
|
|
|
$horAlign = (0x07 & ord($recordData[6])) >> 0; |
|
|
|
|
switch ($horAlign) { |
|
|
|
|
case 0: |
|
|
|
|
$objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_GENERAL); |
|
|
|
@ -2150,7 +2150,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// bit 3, mask 0x08; wrap text |
|
|
|
|
$wrapText = (0x08 & ord($recordData{6})) >> 3; |
|
|
|
|
$wrapText = (0x08 & ord($recordData[6])) >> 3; |
|
|
|
|
switch ($wrapText) { |
|
|
|
|
case 0: |
|
|
|
|
$objStyle->getAlignment()->setWrapText(false); |
|
|
|
@ -2160,7 +2160,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// bit 6-4, mask 0x70; vertical alignment |
|
|
|
|
$vertAlign = (0x70 & ord($recordData{6})) >> 4; |
|
|
|
|
$vertAlign = (0x70 & ord($recordData[6])) >> 4; |
|
|
|
|
switch ($vertAlign) { |
|
|
|
|
case 0: |
|
|
|
|
$objStyle->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP); |
|
|
|
@ -2178,7 +2178,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
|
|
|
|
|
if ($this->version == self::XLS_BIFF8) { |
|
|
|
|
// offset: 7; size: 1; XF_ROTATION: Text rotation angle |
|
|
|
|
$angle = ord($recordData{7}); |
|
|
|
|
$angle = ord($recordData[7]); |
|
|
|
|
$rotation = 0; |
|
|
|
|
if ($angle <= 90) { |
|
|
|
|
$rotation = $angle; |
|
|
|
@ -2191,11 +2191,11 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
|
|
|
|
|
// offset: 8; size: 1; Indentation, shrink to cell size, and text direction |
|
|
|
|
// bit: 3-0; mask: 0x0F; indent level |
|
|
|
|
$indent = (0x0F & ord($recordData{8})) >> 0; |
|
|
|
|
$indent = (0x0F & ord($recordData[8])) >> 0; |
|
|
|
|
$objStyle->getAlignment()->setIndent($indent); |
|
|
|
|
|
|
|
|
|
// bit: 4; mask: 0x10; 1 = shrink content to fit into cell |
|
|
|
|
$shrinkToFit = (0x10 & ord($recordData{8})) >> 4; |
|
|
|
|
$shrinkToFit = (0x10 & ord($recordData[8])) >> 4; |
|
|
|
|
switch ($shrinkToFit) { |
|
|
|
|
case 0: |
|
|
|
|
$objStyle->getAlignment()->setShrinkToFit(false); |
|
|
|
@ -2275,7 +2275,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
// BIFF5 |
|
|
|
|
|
|
|
|
|
// offset: 7; size: 1; Text orientation and flags |
|
|
|
|
$orientationAndFlags = ord($recordData{7}); |
|
|
|
|
$orientationAndFlags = ord($recordData[7]); |
|
|
|
|
|
|
|
|
|
// bit: 1-0; mask: 0x03; XF_ORIENTATION: Text orientation |
|
|
|
|
$xfOrientation = (0x03 & $orientationAndFlags) >> 0; |
|
|
|
@ -2399,7 +2399,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) |
|
|
|
|
|
|
|
|
|
if ($xclfType == 2) { |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); |
|
|
|
|
|
|
|
|
|
// modify the relevant style property |
|
|
|
|
if (isset($this->mapCellXfIndex[$ixfe])) { |
|
|
|
@ -2414,7 +2414,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) |
|
|
|
|
|
|
|
|
|
if ($xclfType == 2) { |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); |
|
|
|
|
|
|
|
|
|
// modify the relevant style property |
|
|
|
|
if (isset($this->mapCellXfIndex[$ixfe])) { |
|
|
|
@ -2429,7 +2429,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) |
|
|
|
|
|
|
|
|
|
if ($xclfType == 2) { |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); |
|
|
|
|
|
|
|
|
|
// modify the relevant style property |
|
|
|
|
if (isset($this->mapCellXfIndex[$ixfe])) { |
|
|
|
@ -2444,7 +2444,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) |
|
|
|
|
|
|
|
|
|
if ($xclfType == 2) { |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); |
|
|
|
|
|
|
|
|
|
// modify the relevant style property |
|
|
|
|
if (isset($this->mapCellXfIndex[$ixfe])) { |
|
|
|
@ -2459,7 +2459,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) |
|
|
|
|
|
|
|
|
|
if ($xclfType == 2) { |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); |
|
|
|
|
|
|
|
|
|
// modify the relevant style property |
|
|
|
|
if (isset($this->mapCellXfIndex[$ixfe])) { |
|
|
|
@ -2474,7 +2474,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) |
|
|
|
|
|
|
|
|
|
if ($xclfType == 2) { |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); |
|
|
|
|
|
|
|
|
|
// modify the relevant style property |
|
|
|
|
if (isset($this->mapCellXfIndex[$ixfe])) { |
|
|
|
@ -2489,7 +2489,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) |
|
|
|
|
|
|
|
|
|
if ($xclfType == 2) { |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); |
|
|
|
|
|
|
|
|
|
// modify the relevant style property |
|
|
|
|
if (isset($this->mapCellXfIndex[$ixfe])) { |
|
|
|
@ -2504,7 +2504,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xclrValue = substr($extData, 4, 4); // color value (value based on color type) |
|
|
|
|
|
|
|
|
|
if ($xclfType == 2) { |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue{0}), ord($xclrValue{1}), ord($xclrValue{2})); |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', ord($xclrValue[0]), ord($xclrValue[1]), ord($xclrValue[2])); |
|
|
|
|
|
|
|
|
|
// modify the relevant style property |
|
|
|
|
if (isset($this->mapCellXfIndex[$ixfe])) { |
|
|
|
@ -2546,7 +2546,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
|
|
|
|
|
if ($isBuiltIn) { |
|
|
|
|
// offset: 2; size: 1; identifier for built-in style |
|
|
|
|
$builtInId = ord($recordData{2}); |
|
|
|
|
$builtInId = ord($recordData[2]); |
|
|
|
|
|
|
|
|
|
switch ($builtInId) { |
|
|
|
|
case 0x00: |
|
|
|
@ -2611,7 +2611,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$this->pos += 4 + $length; |
|
|
|
|
|
|
|
|
|
// offset: 4; size: 1; sheet state |
|
|
|
|
switch (ord($recordData{4})) { |
|
|
|
|
switch (ord($recordData[4])) { |
|
|
|
|
case 0x00: |
|
|
|
|
$sheetState = PHPExcel_Worksheet::SHEETSTATE_VISIBLE; |
|
|
|
|
break; |
|
|
|
@ -2627,7 +2627,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// offset: 5; size: 1; sheet type |
|
|
|
|
$sheetType = ord($recordData{5}); |
|
|
|
|
$sheetType = ord($recordData[5]); |
|
|
|
|
|
|
|
|
|
// offset: 6; size: var; sheet name |
|
|
|
|
if ($this->version == self::XLS_BIFF8) { |
|
|
|
@ -2805,7 +2805,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
// offset: 2; size: 1; keyboard shortcut |
|
|
|
|
|
|
|
|
|
// offset: 3; size: 1; length of the name (character count) |
|
|
|
|
$nlen = ord($recordData{3}); |
|
|
|
|
$nlen = ord($recordData[3]); |
|
|
|
|
|
|
|
|
|
// offset: 4; size: 2; size of the formula data (it can happen that this is zero) |
|
|
|
|
// note: there can also be additional data, this is not included in $flen |
|
|
|
@ -2888,7 +2888,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$pos += 2; |
|
|
|
|
|
|
|
|
|
// option flags |
|
|
|
|
$optionFlags = ord($recordData{$pos}); |
|
|
|
|
$optionFlags = ord($recordData[$pos]); |
|
|
|
|
++$pos; |
|
|
|
|
|
|
|
|
|
// bit: 0; mask: 0x01; 0 = compressed; 1 = uncompressed |
|
|
|
@ -2955,7 +2955,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
|
|
|
|
|
// repeated option flags |
|
|
|
|
// OpenOffice.org documentation 5.21 |
|
|
|
|
$option = ord($recordData{$pos}); |
|
|
|
|
$option = ord($recordData[$pos]); |
|
|
|
|
++$pos; |
|
|
|
|
|
|
|
|
|
if ($isCompressed && ($option == 0)) { |
|
|
|
@ -2977,7 +2977,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
// this fragment compressed |
|
|
|
|
$len = min($charsLeft, $limitpos - $pos); |
|
|
|
|
for ($j = 0; $j < $len; ++$j) { |
|
|
|
|
$retstr .= $recordData{$pos + $j} . chr(0); |
|
|
|
|
$retstr .= $recordData[$pos + $j] . chr(0); |
|
|
|
|
} |
|
|
|
|
$charsLeft -= $len; |
|
|
|
|
$isCompressed = false; |
|
|
|
@ -3883,7 +3883,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
// We can apparently not rely on $isPartOfSharedFormula. Even when $isPartOfSharedFormula = true |
|
|
|
|
// the formula data may be ordinary formula data, therefore we need to check |
|
|
|
|
// explicitly for the tExp token (0x01) |
|
|
|
|
$isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure{2}) == 0x01; |
|
|
|
|
$isPartOfSharedFormula = $isPartOfSharedFormula && ord($formulaStructure[2]) == 0x01; |
|
|
|
|
|
|
|
|
|
if ($isPartOfSharedFormula) { |
|
|
|
|
// part of shared formula which means there will be a formula with a tExp token and nothing else |
|
|
|
@ -3906,7 +3906,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xfIndex = self::getInt2d($recordData, 4); |
|
|
|
|
|
|
|
|
|
// offset: 6; size: 8; result of the formula |
|
|
|
|
if ((ord($recordData{6}) == 0) && (ord($recordData{12}) == 255) && (ord($recordData{13}) == 255)) { |
|
|
|
|
if ((ord($recordData[6]) == 0) && (ord($recordData[12]) == 255) && (ord($recordData[13]) == 255)) { |
|
|
|
|
// String formula. Result follows in appended STRING record |
|
|
|
|
$dataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|
|
|
|
|
|
|
|
@ -3918,21 +3918,21 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
|
|
|
|
|
// read STRING record |
|
|
|
|
$value = $this->readString(); |
|
|
|
|
} elseif ((ord($recordData{6}) == 1) |
|
|
|
|
&& (ord($recordData{12}) == 255) |
|
|
|
|
&& (ord($recordData{13}) == 255)) { |
|
|
|
|
} elseif ((ord($recordData[6]) == 1) |
|
|
|
|
&& (ord($recordData[12]) == 255) |
|
|
|
|
&& (ord($recordData[13]) == 255)) { |
|
|
|
|
// Boolean formula. Result is in +2; 0=false, 1=true |
|
|
|
|
$dataType = PHPExcel_Cell_DataType::TYPE_BOOL; |
|
|
|
|
$value = (bool) ord($recordData{8}); |
|
|
|
|
} elseif ((ord($recordData{6}) == 2) |
|
|
|
|
&& (ord($recordData{12}) == 255) |
|
|
|
|
&& (ord($recordData{13}) == 255)) { |
|
|
|
|
$value = (bool) ord($recordData[8]); |
|
|
|
|
} elseif ((ord($recordData[6]) == 2) |
|
|
|
|
&& (ord($recordData[12]) == 255) |
|
|
|
|
&& (ord($recordData[13]) == 255)) { |
|
|
|
|
// Error formula. Error code is in +2 |
|
|
|
|
$dataType = PHPExcel_Cell_DataType::TYPE_ERROR; |
|
|
|
|
$value = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($recordData{8})); |
|
|
|
|
} elseif ((ord($recordData{6}) == 3) |
|
|
|
|
&& (ord($recordData{12}) == 255) |
|
|
|
|
&& (ord($recordData{13}) == 255)) { |
|
|
|
|
$value = PHPExcel_Reader_Excel5_ErrorCode::lookup(ord($recordData[8])); |
|
|
|
|
} elseif ((ord($recordData[6]) == 3) |
|
|
|
|
&& (ord($recordData[12]) == 255) |
|
|
|
|
&& (ord($recordData[13]) == 255)) { |
|
|
|
|
// Formula result is a null string |
|
|
|
|
$dataType = PHPExcel_Cell_DataType::TYPE_NULL; |
|
|
|
|
$value = ''; |
|
|
|
@ -3996,7 +3996,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
// offset: 6, size: 1; not used |
|
|
|
|
|
|
|
|
|
// offset: 7, size: 1; number of existing FORMULA records for this shared formula |
|
|
|
|
$no = ord($recordData{7}); |
|
|
|
|
$no = ord($recordData[7]); |
|
|
|
|
|
|
|
|
|
// offset: 8, size: var; Binary token array of the shared formula |
|
|
|
|
$formula = substr($recordData, 8); |
|
|
|
@ -4062,10 +4062,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$xfIndex = self::getInt2d($recordData, 4); |
|
|
|
|
|
|
|
|
|
// offset: 6; size: 1; the boolean value or error value |
|
|
|
|
$boolErr = ord($recordData{6}); |
|
|
|
|
$boolErr = ord($recordData[6]); |
|
|
|
|
|
|
|
|
|
// offset: 7; size: 1; 0=boolean; 1=error |
|
|
|
|
$isError = ord($recordData{7}); |
|
|
|
|
$isError = ord($recordData[7]); |
|
|
|
|
|
|
|
|
|
$cell = $this->phpSheet->getCell($columnString . ($row + 1)); |
|
|
|
|
switch ($isError) { |
|
|
|
@ -4447,7 +4447,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
|
|
|
|
|
if (!$this->readDataOnly) { |
|
|
|
|
// offset: 0; size: 1; pane identifier |
|
|
|
|
$paneId = ord($recordData{0}); |
|
|
|
|
$paneId = ord($recordData[0]); |
|
|
|
|
|
|
|
|
|
// offset: 1; size: 2; index to row of the active cell |
|
|
|
|
$r = self::getInt2d($recordData, 1); |
|
|
|
@ -4598,9 +4598,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$hyperlinkType = 'UNC'; |
|
|
|
|
} elseif (!$isFileLinkOrUrl) { |
|
|
|
|
$hyperlinkType = 'workbook'; |
|
|
|
|
} elseif (ord($recordData{$offset}) == 0x03) { |
|
|
|
|
} elseif (ord($recordData[$offset]) == 0x03) { |
|
|
|
|
$hyperlinkType = 'local'; |
|
|
|
|
} elseif (ord($recordData{$offset}) == 0xE0) { |
|
|
|
|
} elseif (ord($recordData[$offset]) == 0xE0) { |
|
|
|
|
$hyperlinkType = 'URL'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -6886,10 +6886,10 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
$lr = self::getInt2d($subData, 2) + 1; |
|
|
|
|
|
|
|
|
|
// offset: 4; size: 1; index to first column |
|
|
|
|
$fc = ord($subData{4}); |
|
|
|
|
$fc = ord($subData[4]); |
|
|
|
|
|
|
|
|
|
// offset: 5; size: 1; index to last column |
|
|
|
|
$lc = ord($subData{5}); |
|
|
|
|
$lc = ord($subData[5]); |
|
|
|
|
|
|
|
|
|
// check values |
|
|
|
|
if ($fr > $lr || $fc > $lc) { |
|
|
|
@ -7294,13 +7294,13 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
|
|
|
|
|
private static function readRGB($rgb) |
|
|
|
|
{ |
|
|
|
|
// offset: 0; size 1; Red component |
|
|
|
|
$r = ord($rgb{0}); |
|
|
|
|
$r = ord($rgb[0]); |
|
|
|
|
|
|
|
|
|
// offset: 1; size: 1; Green component |
|
|
|
|
$g = ord($rgb{1}); |
|
|
|
|
$g = ord($rgb[1]); |
|
|
|
|
|
|
|
|
|
// offset: 2; size: 1; Blue component |
|
|
|
|
$b = ord($rgb{2}); |
|
|
|
|
$b = ord($rgb[2]); |
|
|
|
|
|
|
|
|
|
// HEX notation, e.g. 'FF00FC' |
|
|
|
|
$rgb = sprintf('%02X%02X%02X', $r, $g, $b); |
|
|
|
|