Update library PHPExcel to version 1.7.3

This commit is contained in:
Dieter Adriaenssens
2010-05-25 22:10:48 +02:00
parent b90a1b496b
commit ee0b2895ce
136 changed files with 7979 additions and 5040 deletions

View File

@@ -22,7 +22,7 @@
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/
@@ -32,24 +32,15 @@ if (!defined('PHPEXCEL_ROOT')) {
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
}
/** PHPExcel */
require_once PHPEXCEL_ROOT . 'PHPExcel.php';
/** PHPExcel_Reader_IReader */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
/** PHPExcel_Worksheet */
require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php';
/** PHPExcel_Cell */
require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
/** PHPExcel_Reader_DefaultReadFilter */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
/**
* PHPExcel_Reader_CSV
*
@@ -60,49 +51,55 @@ require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
{
/**
* Input encoding
* Input encoding
*
* @var string
* @access private
* @var string
*/
private $_inputEncoding;
/**
* Delimiter
* Delimiter
*
* @var string
* @access private
* @var string
*/
private $_delimiter;
/**
* Enclosure
* Enclosure
*
* @var string
* @access private
* @var string
*/
private $_enclosure;
/**
* Line ending
* Line ending
*
* @var string
* @access private
* @var string
*/
private $_lineEnding;
/**
* Sheet index to read
* Sheet index to read
*
* @var int
* @access private
* @var int
*/
private $_sheetIndex;
/**
* PHPExcel_Reader_IReadFilter instance
* PHPExcel_Reader_IReadFilter instance
*
* @var PHPExcel_Reader_IReadFilter
* @access private
* @var PHPExcel_Reader_IReadFilter
*/
private $_readFilter = null;
/**
* Create a new PHPExcel_Reader_CSV
* Create a new PHPExcel_Reader_CSV
*/
public function __construct() {
$this->_inputEncoding = 'UTF-8';
@@ -111,15 +108,17 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
$this->_lineEnding = PHP_EOL;
$this->_sheetIndex = 0;
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
}
} // function __construct()
/**
* Can the current PHPExcel_Reader_IReader read the file?
* Can the current PHPExcel_Reader_IReader read the file?
*
* @param string $pFileName
* @return boolean
*/
public function canRead($pFilename)
* @access public
* @param string $pFileName
* @return boolean
* @throws Exception
*/
public function canRead($pFilename)
{
// Check if file exists
if (!file_exists($pFilename)) {
@@ -127,13 +126,15 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
}
return true;
}
} // function canRead()
/**
* Loads PHPExcel from file
* Loads PHPExcel from file
*
* @param string $pFilename
* @throws Exception
* @access public
* @param string $pFilename
* @return PHPExcel
* @throws Exception
*/
public function load($pFilename)
{
@@ -142,52 +143,60 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
// Load into this instance
return $this->loadIntoExisting($pFilename, $objPHPExcel);
}
} // function load()
/**
* Read filter
* Read filter
*
* @return PHPExcel_Reader_IReadFilter
* @access public
* @return PHPExcel_Reader_IReadFilter
*/
public function getReadFilter() {
return $this->_readFilter;
}
} // function getReadFilter()
/**
* Set read filter
* Set read filter
*
* @param PHPExcel_Reader_IReadFilter $pValue
* @access public
* @param PHPExcel_Reader_IReadFilter $pValue
*/
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
$this->_readFilter = $pValue;
}
return $this;
} // function setReadFilter()
/**
* Set input encoding
* Set input encoding
*
* @param string $pValue Input encoding
* @access public
* @param string $pValue Input encoding
*/
public function setInputEncoding($pValue = 'UTF-8')
{
$this->_inputEncoding = $pValue;
}
return $this;
} // function setInputEncoding()
/**
* Get input encoding
* Get input encoding
*
* @return string
* @access public
* @return string
*/
public function getInputEncoding()
{
return $this->_inputEncoding;
}
} // function getInputEncoding()
/**
* Loads PHPExcel from file into PHPExcel instance
* Loads PHPExcel from file into PHPExcel instance
*
* @param string $pFilename
* @param PHPExcel $objPHPExcel
* @throws Exception
* @access public
* @param string $pFilename
* @param PHPExcel $objPHPExcel
* @return PHPExcel
* @throws Exception
*/
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
{
@@ -214,7 +223,6 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
fseek($fileHandle, 3) : fseek($fileHandle, 0);
break;
default:
break;
}
@@ -231,16 +239,14 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
// Unescape enclosures
$rowData[$i] = str_replace("\\" . $this->_enclosure, $this->_enclosure, $rowData[$i]);
$rowData[$i] = str_replace($this->_enclosure . $this->_enclosure, $this->_enclosure, $rowData[$i]);
// Convert encoding if necessary
if ($this->_inputEncoding !== 'UTF-8') {
$rowData[$i] = PHPExcel_Shared_String::ConvertEncoding($rowData[$i], 'UTF-8', $this->_inputEncoding);
}
// Set cell value
$objPHPExcel->getActiveSheet()->setCellValue(
$columnLetter . $currentRow, $rowData[$i]
);
$objPHPExcel->getActiveSheet()->getCell($columnLetter . $currentRow)->setValue($rowData[$i]);
}
}
}
@@ -250,42 +256,46 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
// Return
return $objPHPExcel;
}
} // function loadIntoExisting()
/**
* Get delimiter
* Get delimiter
*
* @return string
* @access public
* @return string
*/
public function getDelimiter() {
return $this->_delimiter;
}
} // function getDelimiter()
/**
* Set delimiter
* Set delimiter
*
* @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Reader_CSV
* @access public
* @param string $pValue Delimiter, defaults to ,
* @return PHPExcel_Reader_CSV
*/
public function setDelimiter($pValue = ',') {
$this->_delimiter = $pValue;
return $this;
}
} // function setDelimiter()
/**
* Get enclosure
* Get enclosure
*
* @return string
* @access public
* @return string
*/
public function getEnclosure() {
return $this->_enclosure;
}
} // function getEnclosure()
/**
* Set enclosure
* Set enclosure
*
* @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Reader_CSV
* @access public
* @param string $pValue Enclosure, defaults to "
* @return PHPExcel_Reader_CSV
*/
public function setEnclosure($pValue = '"') {
if ($pValue == '') {
@@ -293,45 +303,49 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
}
$this->_enclosure = $pValue;
return $this;
}
} // function setEnclosure()
/**
* Get line ending
* Get line ending
*
* @return string
* @access public
* @return string
*/
public function getLineEnding() {
return $this->_lineEnding;
}
} // function getLineEnding()
/**
* Set line ending
* Set line ending
*
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
* @return PHPExcel_Reader_CSV
* @access public
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL)
* @return PHPExcel_Reader_CSV
*/
public function setLineEnding($pValue = PHP_EOL) {
$this->_lineEnding = $pValue;
return $this;
}
} // function setLineEnding()
/**
* Get sheet index
* Get sheet index
*
* @return int
* @access public
* @return int
*/
public function getSheetIndex() {
return $this->_sheetIndex;
}
} // function getSheetIndex()
/**
* Set sheet index
* Set sheet index
*
* @param int $pValue Sheet index
* @return PHPExcel_Reader_CSV
* @access public
* @param int $pValue Sheet index
* @return PHPExcel_Reader_CSV
*/
public function setSheetIndex($pValue = 0) {
$this->_sheetIndex = $pValue;
return $this;
}
} // function setSheetIndex()
}

View File

@@ -8,12 +8,12 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
@@ -22,7 +22,7 @@
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/
@@ -32,12 +32,15 @@ if (!defined('PHPEXCEL_ROOT')) {
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
}
/** PHPExcel_Reader_IReadFilter */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReadFilter.php';
/**
* PHPExcel_Reader_DefaultReadFilter
*
@@ -54,7 +57,7 @@ class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
* @param $row Row index
* @param $worksheetName Optional worksheet name
* @return boolean
*/
*/
public function readCell($column, $row, $worksheetName = '') {
return true;
}

View File

@@ -22,7 +22,7 @@
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/
@@ -32,27 +32,15 @@ if (!defined('PHPEXCEL_ROOT')) {
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
}
/** PHPExcel */
require_once PHPEXCEL_ROOT . 'PHPExcel.php';
/** PHPExcel_Reader_IReader */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
/** PHPExcel_Worksheet */
require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php';
/** PHPExcel_Cell */
require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
/** PHPExcel_Calculation */
require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation.php';
/** PHPExcel_Reader_DefaultReadFilter */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
/**
* PHPExcel_Reader_Excel2003XML
*
@@ -236,6 +224,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
* Loads PHPExcel from file
*
* @param string $pFilename
* @return PHPExcel
* @throws Exception
*/
public function load($pFilename)
@@ -288,6 +277,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
*
* @param string $pFilename
* @param PHPExcel $objPHPExcel
* @return PHPExcel
* @throws Exception
*/
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
@@ -508,7 +498,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
$objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex($worksheetID);
if (isset($worksheet_ss['Name'])) {
$worksheetName = $worksheet_ss['Name'];
$worksheetName = (string) $worksheet_ss['Name'];
$objPHPExcel->getActiveSheet()->setTitle($worksheetName);
}
@@ -660,7 +650,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
// print_r($this->_styles[$style]);
// echo '<br />';
if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
$objPHPExcel->getActiveSheet()->setCellValue($columnID.$rowID,NULL);
$objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(NULL);
}
$objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->_styles[$style]);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -22,41 +22,9 @@
* @package PHPExcel_Reader_Excel5
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/
/** PHPExcel root directory */
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../../');
}
/** PHPExcel_Cell */
require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
/** PHPExcel_Shared_Escher_DggContainer */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer.php';
/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php';
/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php';
/** PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php';
/** PHPExcel_Shared_Escher_DgContainer */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer.php';
/** PHPExcel_Shared_Escher_DgContainer_SpgrContainer */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php';
/** PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php';
/**
* PHPExcel_Reader_Excel5_Escher
*
@@ -122,7 +90,7 @@ class PHPExcel_Reader_Excel5_Escher
{
$this->_object = $object;
}
/**
* Load Escher stream data. May be a partial Escher stream.
*
@@ -136,14 +104,14 @@ class PHPExcel_Reader_Excel5_Escher
$this->_dataSize = strlen($this->_data);
$this->_pos = 0;
// Parse Escher stream
while ($this->_pos < $this->_dataSize) {
// offset: 2; size: 2: Record Type
$fbt = $this->_GetInt2d($this->_data, $this->_pos + 2);
switch ($fbt) {
case self::DGGCONTAINER: $this->_readDggContainer(); break;
case self::DGG: $this->_readDgg(); break;
@@ -166,7 +134,7 @@ class PHPExcel_Reader_Excel5_Escher
default: $this->_readDefault(); break;
}
}
return $this->_object;
}
@@ -177,16 +145,16 @@ class PHPExcel_Reader_Excel5_Escher
{
// offset 0; size: 2; recVer and recInstance
$verInstance = $this->_GetInt2d($this->_data, $this->_pos);
// offset: 2; size: 2: Record Type
$fbt = $this->_GetInt2d($this->_data, $this->_pos + 2);
// bit: 0-3; mask: 0x000F; recVer
$recVer = (0x000F & $verInstance) >> 0;
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
// move stream pointer to next record
$this->_pos += 8 + $length;
}
@@ -216,7 +184,7 @@ class PHPExcel_Reader_Excel5_Escher
{
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
// move stream pointer to next record
$this->_pos += 8 + $length;
}
@@ -245,22 +213,22 @@ class PHPExcel_Reader_Excel5_Escher
private function _readBSE()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
// move stream pointer to next record
$this->_pos += 8 + $length;
// add BSE to BstoreContainer
$BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
$this->_object->addBSE($BSE);
$BSE->setBLIPType($recInstance);
// offset: 0; size: 1; btWin32 (MSOBLIPTYPE)
$btWin32 = ord($recordData[0]);
@@ -311,38 +279,38 @@ class PHPExcel_Reader_Excel5_Escher
private function _readBlipJPEG()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
// move stream pointer to next record
$this->_pos += 8 + $length;
$pos = 0;
// offset: 0; size: 16; rgbUid1 (MD4 digest of)
$rgbUid1 = substr($recordData, 0, 16);
$pos += 16;
// offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
if (in_array($recInstance, array(0x046B, 0x06E3))) {
$rgbUid2 = substr($recordData, 16, 16);
$pos += 16;
}
// offset: var; size: 1; tag
$tag = ord($recordData{$pos});
$pos += 1;
// offset: var; size: var; the raw image data
$data = substr($recordData, $pos);
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($data);
$this->_object->setBlip($blip);
}
@@ -352,38 +320,38 @@ class PHPExcel_Reader_Excel5_Escher
private function _readBlipPNG()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
// move stream pointer to next record
$this->_pos += 8 + $length;
$pos = 0;
// offset: 0; size: 16; rgbUid1 (MD4 digest of)
$rgbUid1 = substr($recordData, 0, 16);
$pos += 16;
// offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
if ($recInstance == 0x06E1) {
$rgbUid2 = substr($recordData, 16, 16);
$pos += 16;
}
// offset: var; size: 1; tag
$tag = ord($recordData{$pos});
$pos += 1;
// offset: var; size: var; the raw image data
$data = substr($recordData, $pos);
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
$blip->setData($data);
$this->_object->setBlip($blip);
}
@@ -393,13 +361,13 @@ class PHPExcel_Reader_Excel5_Escher
private function _readOPT()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
// move stream pointer to next record
$this->_pos += 8 + $length;
@@ -412,7 +380,7 @@ class PHPExcel_Reader_Excel5_Escher
private function _readTertiaryOPT()
{
// offset: 0; size: 2; recVer and recInstance
// bit: 4-15; mask: 0xFFF0; recInstance
$recInstance = (0xFFF0 & $this->_GetInt2d($this->_data, $this->_pos)) >> 4;
@@ -566,10 +534,10 @@ class PHPExcel_Reader_Excel5_Escher
{
$length = $this->_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
// move stream pointer to next record
$this->_pos += 8 + $length;
// offset: 2; size: 2; upper-left corner column index (0-based)
$c1 = $this->_GetInt2d($recordData, 2);

View File

@@ -22,7 +22,7 @@
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/

View File

@@ -22,7 +22,7 @@
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/

View File

@@ -22,7 +22,7 @@
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/
@@ -32,27 +32,15 @@ if (!defined('PHPEXCEL_ROOT')) {
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
}
/** PHPExcel */
require_once PHPEXCEL_ROOT . 'PHPExcel.php';
/** PHPExcel_Reader_IReader */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
/** PHPExcel_Worksheet */
require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php';
/** PHPExcel_Cell */
require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
/** PHPExcel_Calculation */
require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation.php';
/** PHPExcel_Reader_DefaultReadFilter */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
/**
* PHPExcel_Reader_OOCalc
*
@@ -211,6 +199,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
* Loads PHPExcel from file
*
* @param string $pFilename
* @return PHPExcel
* @throws Exception
*/
public function load($pFilename)
@@ -238,6 +227,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
*
* @param string $pFilename
* @param PHPExcel $objPHPExcel
* @return PHPExcel
* @throws Exception
*/
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
@@ -335,7 +325,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
$objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex($worksheetID);
if (isset($worksheetDataAttributes['name'])) {
$worksheetName = $worksheetDataAttributes['name'];
$worksheetName = (string) $worksheetDataAttributes['name'];
$objPHPExcel->getActiveSheet()->setTitle($worksheetName);
}
@@ -392,7 +382,9 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
break;
case 'date' :
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellDataOfficeAttributes['date-value']));
$dateObj = date_create($cellDataOfficeAttributes['date-value']);
list($year,$month,$day,$hour,$minute,$second) = explode(' ',$dateObj->format('Y m d H i s'));
$dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year,$month,$day,$hour,$minute,$second);
if ($dataValue != floor($dataValue)) {
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
} else {
@@ -421,6 +413,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
if (($key % 2) == 0) {
$value = preg_replace('/\[\.(.*):\.(.*)\]/Ui','$1:$2',$value);
$value = preg_replace('/\[\.(.*)\]/Ui','$1',$value);
$value = PHPExcel_Calculation::_translateSeparator(';',',',$value);
}
}
unset($value);

View File

@@ -22,7 +22,7 @@
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/
@@ -32,27 +32,15 @@ if (!defined('PHPEXCEL_ROOT')) {
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
}
/** PHPExcel */
require_once PHPEXCEL_ROOT . 'PHPExcel.php';
/** PHPExcel_Reader_IReader */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
/** PHPExcel_Worksheet */
require_once PHPEXCEL_ROOT . 'PHPExcel/Worksheet.php';
/** PHPExcel_Cell */
require_once PHPEXCEL_ROOT . 'PHPExcel/Cell.php';
/** PHPExcel_Calculation */
require_once PHPEXCEL_ROOT . 'PHPExcel/Calculation.php';
/** PHPExcel_Reader_DefaultReadFilter */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/DefaultReadFilter.php';
/**
* PHPExcel_Reader_SYLK
*
@@ -167,6 +155,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
* Loads PHPExcel from file
*
* @param string $pFilename
* @return PHPExcel
* @throws Exception
*/
public function load($pFilename)
@@ -194,6 +183,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
*/
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
$this->_readFilter = $pValue;
return $this;
}
/**
@@ -204,6 +194,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
public function setInputEncoding($pValue = 'ANSI')
{
$this->_inputEncoding = $pValue;
return $this;
}
/**
@@ -221,6 +212,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
*
* @param string $pFilename
* @param PHPExcel $objPHPExcel
* @return PHPExcel
* @throws Exception
*/
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
@@ -248,8 +240,17 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
// Loop through file
$rowData = array();
$column = $row = '';
// loop through one row (line) at a time in the file
while (($rowData = fgets($fileHandle)) !== FALSE) {
$rowData = explode("\t",str_replace('<27>',';',str_replace(';',"\t",str_replace(';;','<27>',rtrim($rowData)))));
// convert SYLK encoded $rowData to UTF-8
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
// explode each row at semicolons while taking into account that literal semicolon (;)
// is escaped like this (;;)
$rowData = explode("\t",str_replace('¤',';',str_replace(';',"\t",str_replace(';;','¤',rtrim($rowData)))));
$dataType = array_shift($rowData);
// Read shared styles
if ($dataType == 'P') {
@@ -337,8 +338,9 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
}
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
$cellData = PHPExcel_Calculation::_unwrapResult($cellData);
// Set cell value
$objPHPExcel->getActiveSheet()->setCellValue($columnLetter.$row, (($hasCalculatedValue) ? $cellDataFormula : $cellData));
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
if ($hasCalculatedValue) {
$cellData = PHPExcel_Calculation::_unwrapResult($cellData);
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
@@ -503,4 +505,5 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
$this->_sheetIndex = $pValue;
return $this;
}
}

View File

@@ -22,7 +22,7 @@
* @package PHPExcel_Reader
* @copyright Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.2, 2010-01-11
* @version 1.7.3, 2010-05-17
*/
@@ -32,18 +32,15 @@ if (!defined('PHPEXCEL_ROOT')) {
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
PHPExcel_Autoloader::Register();
PHPExcel_Shared_ZipStreamWrapper::register();
// check mbstring.func_overload
if (ini_get('mbstring.func_overload') & 2) {
throw new Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
}
}
/** PHPExcel */
require_once PHPEXCEL_ROOT . 'PHPExcel.php';
/** PHPExcel_Reader_IReader */
require_once PHPEXCEL_ROOT . 'PHPExcel/Reader/IReader.php';
/** PHPExcel_Shared_File */
require_once PHPEXCEL_ROOT . 'PHPExcel/Shared/File.php';
/**
* PHPExcel_Reader_Serialized
*
@@ -58,17 +55,17 @@ class PHPExcel_Reader_Serialized implements PHPExcel_Reader_IReader
*
* @param string $pFileName
* @return boolean
*/
public function canRead($pFilename)
*/
public function canRead($pFilename)
{
// Check if file exists
if (!file_exists($pFilename)) {
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}
return $this->fileSupportsUnserializePHPExcel($pFilename);
}
/**
* Loads PHPExcel Serialized file
*