diff --git a/Classes/PHPExcel/Reader/Excel5.php b/Classes/PHPExcel/Reader/Excel5.php index 770d43569..68ce62518 100644 --- a/Classes/PHPExcel/Reader/Excel5.php +++ b/Classes/PHPExcel/Reader/Excel5.php @@ -153,7 +153,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce const MS_BIFF_CRYPTO_NONE = 0; const MS_BIFF_CRYPTO_XOR = 1; const MS_BIFF_CRYPTO_RC4 = 2; - + // Size of stream blocks when using RC4 encryption const REKEY_BLOCK = 0x400; @@ -382,7 +382,7 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce * @var int */ private $encryption = 0; - + /** * The position in the stream after which contents are encrypted * @@ -1221,7 +1221,7 @@ public function load($pFilename) return $this->phpExcel; } - + /** * Read record data from stream, decrypting as required * @@ -1234,12 +1234,12 @@ public function load($pFilename) private function readRecordData($data, $pos, $len) { $data = substr($data, $pos, $len); - + // File not encrypted, or record before encryption start point if ($this->encryption == self::MS_BIFF_CRYPTO_NONE || $pos < $this->encryptionStartPos) { return $data; } - + $recordData = ''; if ($this->encryption == self::MS_BIFF_CRYPTO_RC4) { $oldBlock = floor($this->rc4Pos / self::REKEY_BLOCK); @@ -1748,16 +1748,16 @@ private function readFilepass() if ($length != 54) { throw new PHPExcel_Reader_Exception('Unexpected file pass record length'); } - + $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); - + // move stream pointer to next record $this->pos += 4 + $length; if (!$this->verifyPassword('VelvetSweatshop', substr($recordData, 6, 16), substr($recordData, 22, 16), substr($recordData, 38, 16), $this->md5Ctxt)) { throw new PHPExcel_Reader_Exception('Decryption password incorrect'); } - + $this->encryption = self::MS_BIFF_CRYPTO_RC4; // Decryption required from the record after next onwards @@ -1779,7 +1779,7 @@ private function makeKey($block, $valContext) for ($i = 0; $i < 5; $i++) { $pwarray[$i] = $valContext[$i]; } - + $pwarray[5] = chr($block & 0xff); $pwarray[6] = chr(($block >> 8) & 0xff); $pwarray[7] = chr(($block >> 16) & 0xff); @@ -1868,7 +1868,7 @@ private function verifyPassword($password, $docid, $salt_data, $hashedsalt_data, $salt = $key->RC4($salt_data); $hashedsalt = $key->RC4($hashedsalt_data); - + $salt .= "\x80" . str_repeat("\0", 47); $salt[56] = "\x80"; @@ -3541,7 +3541,9 @@ private function readColInfo() $this->phpSheet->getColumnDimensionByColumn($i)->setVisible(!$isHidden); $this->phpSheet->getColumnDimensionByColumn($i)->setOutlineLevel($level); $this->phpSheet->getColumnDimensionByColumn($i)->setCollapsed($isCollapsed); - $this->phpSheet->getColumnDimensionByColumn($i)->setXfIndex($this->mapCellXfIndex[$xfIndex]); + if(!empty($this->mapCellXfIndex[$xfIndex])){ + $this->phpSheet->getColumnDimensionByColumn($i)->setXfIndex($this->mapCellXfIndex[$xfIndex]); + } } } }