mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 13:26:07 +03:00
Change reader exceptions to PHPExcel_Reader_Exception
This commit is contained in:
parent
d66f61bfbb
commit
8f3640e44c
@ -92,7 +92,7 @@ class PHPExcel_Calculation_DateTime {
|
|||||||
(PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
|
(PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC)) {
|
||||||
return PHPExcel_Calculation_Functions::VALUE();
|
return PHPExcel_Calculation_Functions::VALUE();
|
||||||
}
|
}
|
||||||
if ((is_object($dateValue)) && ($dateValue instanceof PHPExcel_Shared_Date::$dateTimeObjectType)) {
|
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
||||||
$dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue);
|
$dateValue = PHPExcel_Shared_Date::PHPToExcel($dateValue);
|
||||||
} else {
|
} else {
|
||||||
$saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
|
$saveReturnDateType = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||||
|
@ -113,8 +113,8 @@ class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder
|
|||||||
|
|
||||||
// Check for currency
|
// Check for currency
|
||||||
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
|
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
|
||||||
$decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator();
|
$decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator();
|
||||||
$thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator();
|
$thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator();
|
||||||
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
|
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
|
||||||
// Convert value to number
|
// Convert value to number
|
||||||
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
|
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
|
||||||
|
@ -124,13 +124,13 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -190,19 +190,19 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'r');
|
$fileHandle = fopen($pFilename, 'r');
|
||||||
if ($fileHandle === false) {
|
if ($fileHandle === false) {
|
||||||
throw new Exception("Could not open file " . $pFilename . " for reading.");
|
throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip BOM, if any
|
// Skip BOM, if any
|
||||||
@ -262,7 +262,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
* @access public
|
* @access public
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -281,13 +281,13 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new PHPExcel
|
// Create new PHPExcel
|
||||||
@ -302,7 +302,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'r');
|
$fileHandle = fopen($pFilename, 'r');
|
||||||
if ($fileHandle === false) {
|
if ($fileHandle === false) {
|
||||||
throw new Exception("Could not open file $pFilename for reading.");
|
throw new PHPExcel_Reader_Exception("Could not open file $pFilename for reading.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip BOM, if any
|
// Skip BOM, if any
|
||||||
|
@ -174,7 +174,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
@ -196,7 +196,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read sample data (first 2 KB will do)
|
// Read sample data (first 2 KB will do)
|
||||||
@ -227,16 +227,16 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetNames($pFilename)
|
public function listWorksheetNames($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
if (!$this->canRead($pFilename)) {
|
if (!$this->canRead($pFilename)) {
|
||||||
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
|
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetNames = array();
|
$worksheetNames = array();
|
||||||
@ -258,13 +258,13 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
@ -330,7 +330,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -392,7 +392,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
@ -427,11 +427,11 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->canRead($pFilename)) {
|
if (!$this->canRead($pFilename)) {
|
||||||
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
|
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml = simplexml_load_file($pFilename);
|
$xml = simplexml_load_file($pFilename);
|
||||||
|
@ -226,18 +226,18 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if zip class exists
|
// Check if zip class exists
|
||||||
if (!class_exists('ZipArchive',FALSE)) {
|
if (!class_exists('ZipArchive',FALSE)) {
|
||||||
throw new Exception("ZipArchive library is not enabled");
|
throw new PHPExcel_Reader_Exception("ZipArchive library is not enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
$xl = false;
|
$xl = false;
|
||||||
@ -269,13 +269,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
@ -439,13 +439,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetNames($pFilename)
|
public function listWorksheetNames($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetNames = array();
|
$worksheetNames = array();
|
||||||
@ -478,13 +478,13 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialisations
|
// Initialisations
|
||||||
|
@ -510,13 +510,13 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -526,8 +526,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// get excel data
|
// get excel data
|
||||||
$res = $ole->read($pFilename);
|
$res = $ole->read($pFilename);
|
||||||
return true;
|
return true;
|
||||||
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
} catch (Exception $e) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -537,13 +536,13 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetNames($pFilename)
|
public function listWorksheetNames($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetNames = array();
|
$worksheetNames = array();
|
||||||
@ -586,13 +585,13 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
@ -681,7 +680,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -1648,7 +1647,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
case self::XLS_WorkbookGlobals:
|
case self::XLS_WorkbookGlobals:
|
||||||
$version = self::_GetInt2d($recordData, 0);
|
$version = self::_GetInt2d($recordData, 0);
|
||||||
if (($version != self::XLS_BIFF8) && ($version != self::XLS_BIFF7)) {
|
if (($version != self::XLS_BIFF8) && ($version != self::XLS_BIFF7)) {
|
||||||
throw new Exception('Cannot read this Excel file. Version is too old.');
|
throw new PHPExcel_Reader_Exception('Cannot read this Excel file. Version is too old.');
|
||||||
}
|
}
|
||||||
$this->_version = $version;
|
$this->_version = $version;
|
||||||
break;
|
break;
|
||||||
@ -1689,7 +1688,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// move stream pointer to next record
|
// move stream pointer to next record
|
||||||
$this->_pos += 4 + $length;
|
$this->_pos += 4 + $length;
|
||||||
|
|
||||||
throw new Exception('Cannot read encrypted file');
|
throw new PHPExcel_Reader_Exception('Cannot read encrypted file');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2635,7 +2634,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$formula = $this->_getFormulaFromStructure($formulaStructure);
|
$formula = $this->_getFormulaFromStructure($formulaStructure);
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
$formula = '';
|
$formula = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3777,12 +3776,12 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// add cell value. If we can read formula, populate with formula, otherwise just used cached value
|
// add cell value. If we can read formula, populate with formula, otherwise just used cached value
|
||||||
try {
|
try {
|
||||||
if ($this->_version != self::XLS_BIFF8) {
|
if ($this->_version != self::XLS_BIFF8) {
|
||||||
throw new Exception('Not BIFF8. Can only read BIFF8 formulas');
|
throw new PHPExcel_Reader_Exception('Not BIFF8. Can only read BIFF8 formulas');
|
||||||
}
|
}
|
||||||
$formula = $this->_getFormulaFromStructure($formulaStructure); // get formula in human language
|
$formula = $this->_getFormulaFromStructure($formulaStructure); // get formula in human language
|
||||||
$cell->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
|
$cell->setValueExplicit('=' . $formula, PHPExcel_Cell_DataType::TYPE_FORMULA);
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
$cell->setValueExplicit($value, $dataType);
|
$cell->setValueExplicit($value, $dataType);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -4299,7 +4298,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// offset: 0; size: 8; cell range address of all cells containing this hyperlink
|
// offset: 0; size: 8; cell range address of all cells containing this hyperlink
|
||||||
try {
|
try {
|
||||||
$cellRange = $this->_readBIFF8CellRangeAddressFixed($recordData, 0, 8);
|
$cellRange = $this->_readBIFF8CellRangeAddressFixed($recordData, 0, 8);
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4583,7 +4582,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
if ($type == PHPExcel_Cell_DataValidation::TYPE_LIST) {
|
if ($type == PHPExcel_Cell_DataValidation::TYPE_LIST) {
|
||||||
$formula1 = str_replace(chr(0), ',', $formula1);
|
$formula1 = str_replace(chr(0), ',', $formula1);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$offset += $sz1;
|
$offset += $sz1;
|
||||||
@ -4600,7 +4599,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$formula2 = pack('v', $sz2) . $formula2; // prepend the length
|
$formula2 = pack('v', $sz2) . $formula2; // prepend the length
|
||||||
try {
|
try {
|
||||||
$formula2 = $this->_getFormulaFromStructure($formula2);
|
$formula2 = $this->_getFormulaFromStructure($formula2);
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$offset += $sz2;
|
$offset += $sz2;
|
||||||
@ -4812,7 +4811,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
for ($i = 0; $i < $cref; ++$i) {
|
for ($i = 0; $i < $cref; ++$i) {
|
||||||
try {
|
try {
|
||||||
$cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8));
|
$cellRange = $this->_readBIFF8CellRangeAddressFixed(substr($recordData, 27 + 8 * $i, 8));
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$cellRanges[] = $cellRange;
|
$cellRanges[] = $cellRange;
|
||||||
@ -5244,7 +5243,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
* @param string Formula data
|
* @param string Formula data
|
||||||
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
|
* @param string $baseCell Base cell, only needed when formula contains tRefN tokens, e.g. with shared formulas
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
private function _getNextToken($formulaData, $baseCell = 'A1')
|
private function _getNextToken($formulaData, $baseCell = 'A1')
|
||||||
{
|
{
|
||||||
@ -5345,7 +5344,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$spacetype = 'type5';
|
$spacetype = 'type5';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception('Unrecognized space type in tAttrSpace token');
|
throw new PHPExcel_Reader_Exception('Unrecognized space type in tAttrSpace token');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// offset: 3; size: 1; number of inserted spaces/carriage returns
|
// offset: 3; size: 1; number of inserted spaces/carriage returns
|
||||||
@ -5354,7 +5353,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$data = array('spacetype' => $spacetype, 'spacecount' => $spacecount);
|
$data = array('spacetype' => $spacetype, 'spacecount' => $spacecount);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Exception('Unrecognized attribute flag in tAttr token');
|
throw new PHPExcel_Reader_Exception('Unrecognized attribute flag in tAttr token');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -5559,7 +5558,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
case 360: $function = 'PHONETIC'; $args = 1; break;
|
case 360: $function = 'PHONETIC'; $args = 1; break;
|
||||||
case 368: $function = 'BAHTTEXT'; $args = 1; break;
|
case 368: $function = 'BAHTTEXT'; $args = 1; break;
|
||||||
default:
|
default:
|
||||||
throw new Exception('Unrecognized function in formula');
|
throw new PHPExcel_Reader_Exception('Unrecognized function in formula');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$data = array('function' => $function, 'args' => $args);
|
$data = array('function' => $function, 'args' => $args);
|
||||||
@ -5663,7 +5662,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
case 366: $function = 'STDEVA'; break;
|
case 366: $function = 'STDEVA'; break;
|
||||||
case 367: $function = 'VARA'; break;
|
case 367: $function = 'VARA'; break;
|
||||||
default:
|
default:
|
||||||
throw new Exception('Unrecognized function in formula');
|
throw new PHPExcel_Reader_Exception('Unrecognized function in formula');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$data = array('function' => $function, 'args' => $args);
|
$data = array('function' => $function, 'args' => $args);
|
||||||
@ -5764,7 +5763,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4));
|
$cellAddress = $this->_readBIFF8CellAddress(substr($formulaData, 3, 4));
|
||||||
|
|
||||||
$data = "$sheetRange!$cellAddress";
|
$data = "$sheetRange!$cellAddress";
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
// deleted sheet reference
|
// deleted sheet reference
|
||||||
$data = '#REF!';
|
$data = '#REF!';
|
||||||
}
|
}
|
||||||
@ -5783,7 +5782,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8));
|
$cellRangeAddress = $this->_readBIFF8CellRangeAddress(substr($formulaData, 3, 8));
|
||||||
|
|
||||||
$data = "$sheetRange!$cellRangeAddress";
|
$data = "$sheetRange!$cellRangeAddress";
|
||||||
} catch (Exception $e) {
|
} catch (PHPExcel_Reader_Exception $e) {
|
||||||
// deleted sheet reference
|
// deleted sheet reference
|
||||||
$data = '#REF!';
|
$data = '#REF!';
|
||||||
}
|
}
|
||||||
@ -5791,7 +5790,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
break;
|
break;
|
||||||
// Unknown cases // don't know how to deal with
|
// Unknown cases // don't know how to deal with
|
||||||
default:
|
default:
|
||||||
throw new Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula');
|
throw new PHPExcel_Reader_Exception('Unrecognized token ' . sprintf('%02X', $id) . ' in formula');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5885,7 +5884,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $subData
|
* @param string $subData
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
private function _readBIFF5CellRangeAddressFixed($subData)
|
private function _readBIFF5CellRangeAddressFixed($subData)
|
||||||
{
|
{
|
||||||
@ -5903,7 +5902,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// check values
|
// check values
|
||||||
if ($fr > $lr || $fc > $lc) {
|
if ($fr > $lr || $fc > $lc) {
|
||||||
throw new Exception('Not a cell range address');
|
throw new PHPExcel_Reader_Exception('Not a cell range address');
|
||||||
}
|
}
|
||||||
|
|
||||||
// column index to letter
|
// column index to letter
|
||||||
@ -5924,7 +5923,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $subData
|
* @param string $subData
|
||||||
* @return string
|
* @return string
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
private function _readBIFF8CellRangeAddressFixed($subData)
|
private function _readBIFF8CellRangeAddressFixed($subData)
|
||||||
{
|
{
|
||||||
@ -5942,7 +5941,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
// check values
|
// check values
|
||||||
if ($fr > $lr || $fc > $lc) {
|
if ($fr > $lr || $fc > $lc) {
|
||||||
throw new Exception('Not a cell range address');
|
throw new PHPExcel_Reader_Exception('Not a cell range address');
|
||||||
}
|
}
|
||||||
|
|
||||||
// column index to letter
|
// column index to letter
|
||||||
@ -6152,11 +6151,11 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
* Get a sheet range like Sheet1:Sheet3 from REF index
|
* Get a sheet range like Sheet1:Sheet3 from REF index
|
||||||
* Note: If there is only one sheet in the range, one gets e.g Sheet1
|
* Note: If there is only one sheet in the range, one gets e.g Sheet1
|
||||||
* It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets,
|
* It can also happen that the REF structure uses the -1 (FFFF) code to indicate deleted sheets,
|
||||||
* in which case an exception is thrown
|
* in which case an PHPExcel_Reader_Exception is thrown
|
||||||
*
|
*
|
||||||
* @param int $index
|
* @param int $index
|
||||||
* @return string|false
|
* @return string|false
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
private function _readSheetRangeByRefIndex($index)
|
private function _readSheetRangeByRefIndex($index)
|
||||||
{
|
{
|
||||||
@ -6168,7 +6167,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
case 'internal':
|
case 'internal':
|
||||||
// check if we have a deleted 3d reference
|
// check if we have a deleted 3d reference
|
||||||
if ($this->_ref[$index]['firstSheetIndex'] == 0xFFFF or $this->_ref[$index]['lastSheetIndex'] == 0xFFFF) {
|
if ($this->_ref[$index]['firstSheetIndex'] == 0xFFFF or $this->_ref[$index]['lastSheetIndex'] == 0xFFFF) {
|
||||||
throw new Exception('Deleted sheet reference');
|
throw new PHPExcel_Reader_Exception('Deleted sheet reference');
|
||||||
}
|
}
|
||||||
|
|
||||||
// we have normal sheet range (collapsed or uncollapsed)
|
// we have normal sheet range (collapsed or uncollapsed)
|
||||||
@ -6198,7 +6197,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// TODO: external sheet support
|
// TODO: external sheet support
|
||||||
throw new Exception('Excel5 reader only supports internal sheets in fomulas');
|
throw new PHPExcel_Reader_Exception('Excel5 reader only supports internal sheets in fomulas');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
52
Classes/PHPExcel/Reader/Exception.php
Normal file
52
Classes/PHPExcel/Reader/Exception.php
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PHPExcel
|
||||||
|
*
|
||||||
|
* Copyright (c) 2006 - 2012 PHPExcel
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
|
* @version ##VERSION##, ##DATE##
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHPExcel_Reader_Exception
|
||||||
|
*
|
||||||
|
* @category PHPExcel
|
||||||
|
* @package PHPExcel_Reader
|
||||||
|
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||||
|
*/
|
||||||
|
class PHPExcel_Reader_Exception extends Exception {
|
||||||
|
/**
|
||||||
|
* Error handler callback
|
||||||
|
*
|
||||||
|
* @param mixed $code
|
||||||
|
* @param mixed $string
|
||||||
|
* @param mixed $file
|
||||||
|
* @param mixed $line
|
||||||
|
* @param mixed $context
|
||||||
|
*/
|
||||||
|
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
||||||
|
$e = new self($string, $code);
|
||||||
|
$e->line = $line;
|
||||||
|
$e->file = $file;
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
@ -191,18 +191,18 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if gzlib functions are available
|
// Check if gzlib functions are available
|
||||||
if (!function_exists('gzread')) {
|
if (!function_exists('gzread')) {
|
||||||
throw new Exception("gzlib library is not enabled");
|
throw new PHPExcel_Reader_Exception("gzlib library is not enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read signature data (first 3 bytes)
|
// Read signature data (first 3 bytes)
|
||||||
@ -222,13 +222,13 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
$gFileData = $this->_gzfileGetContents($pFilename);
|
||||||
@ -286,7 +286,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -302,13 +302,13 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetNames($pFilename)
|
public function listWorksheetNames($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$gFileData = $this->_gzfileGetContents($pFilename);
|
$gFileData = $this->_gzfileGetContents($pFilename);
|
||||||
@ -334,13 +334,13 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$timezoneObj = new DateTimeZone('Europe/London');
|
$timezoneObj = new DateTimeZone('Europe/London');
|
||||||
|
@ -120,13 +120,13 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read sample data (first 2 KB will do)
|
// Read sample data (first 2 KB will do)
|
||||||
@ -147,7 +147,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -243,7 +243,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent){
|
private function _processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent){
|
||||||
foreach($element->childNodes as $child){
|
foreach($element->childNodes as $child){
|
||||||
if ($child instanceOf DOMText) {
|
if ($child instanceof DOMText) {
|
||||||
$domText = preg_replace('/\s+/',' ',trim($child->nodeValue));
|
$domText = preg_replace('/\s+/',' ',trim($child->nodeValue));
|
||||||
if (is_string($cellContent)) {
|
if (is_string($cellContent)) {
|
||||||
// simply append the text if the cell content is a plain text string
|
// simply append the text if the cell content is a plain text string
|
||||||
@ -252,7 +252,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
// but if we have a rich text run instead, we need to append it correctly
|
// but if we have a rich text run instead, we need to append it correctly
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
} elseif($child instanceOf DOMElement) {
|
} elseif($child instanceof DOMElement) {
|
||||||
echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
|
echo '<b>DOM ELEMENT: </b>' , strtoupper($child->nodeName) , '<br />';
|
||||||
|
|
||||||
$attributeArray = array();
|
$attributeArray = array();
|
||||||
@ -438,17 +438,17 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_file($pFilename)) {
|
if (!is_file($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! The given file is not a regular file.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! The given file is not a regular file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new PHPExcel
|
// Create new PHPExcel
|
||||||
@ -462,7 +462,7 @@ class PHPExcel_Reader_HTML implements PHPExcel_Reader_IReader
|
|||||||
// Load the HTML file into the DOM object
|
// Load the HTML file into the DOM object
|
||||||
$loaded = $dom->loadHTMLFile($pFilename);
|
$loaded = $dom->loadHTMLFile($pFilename);
|
||||||
if ($loaded === false) {
|
if ($loaded === false) {
|
||||||
throw new Exception('Failed to load ',$pFilename,' as a DOM Document');
|
throw new PHPExcel_Reader_Exception('Failed to load ',$pFilename,' as a DOM Document');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard white space
|
// Discard white space
|
||||||
|
@ -47,7 +47,7 @@ interface PHPExcel_Reader_IReader
|
|||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename);
|
public function load($pFilename);
|
||||||
}
|
}
|
||||||
|
@ -180,18 +180,18 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if zip class exists
|
// Check if zip class exists
|
||||||
if (!class_exists('ZipArchive',FALSE)) {
|
if (!class_exists('ZipArchive',FALSE)) {
|
||||||
throw new Exception("ZipArchive library is not enabled");
|
throw new PHPExcel_Reader_Exception("ZipArchive library is not enabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load file
|
// Load file
|
||||||
@ -219,13 +219,13 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetNames($pFilename)
|
public function listWorksheetNames($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetNames = array();
|
$worksheetNames = array();
|
||||||
@ -256,7 +256,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -284,13 +284,13 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
@ -358,13 +358,13 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$timezoneObj = new DateTimeZone('Europe/London');
|
$timezoneObj = new DateTimeZone('Europe/London');
|
||||||
|
@ -93,13 +93,13 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFileName
|
* @param string $pFileName
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read sample data (first 2 KB will do)
|
// Read sample data (first 2 KB will do)
|
||||||
@ -171,19 +171,19 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'r');
|
$fileHandle = fopen($pFilename, 'r');
|
||||||
if ($fileHandle === false) {
|
if ($fileHandle === false) {
|
||||||
throw new Exception("Could not open file " . $pFilename . " for reading.");
|
throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
@ -244,7 +244,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
@ -262,13 +262,13 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new PHPExcel
|
// Create new PHPExcel
|
||||||
@ -283,7 +283,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
// Open file
|
// Open file
|
||||||
$fileHandle = fopen($pFilename, 'r');
|
$fileHandle = fopen($pFilename, 'r');
|
||||||
if ($fileHandle === false) {
|
if ($fileHandle === false) {
|
||||||
throw new Exception("Could not open file $pFilename for reading.");
|
throw new PHPExcel_Reader_Exception("Could not open file $pFilename for reading.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop through file
|
// Loop through file
|
||||||
|
@ -69,15 +69,6 @@ class PHPExcel_Shared_Date
|
|||||||
*/
|
*/
|
||||||
private static $ExcelBaseDate = self::CALENDAR_WINDOWS_1900;
|
private static $ExcelBaseDate = self::CALENDAR_WINDOWS_1900;
|
||||||
|
|
||||||
/*
|
|
||||||
* Object type for PHP Date/Time values
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public static $dateTimeObjectType = 'DateTime';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the Excel calendar (Windows 1900 or Mac 1904)
|
* Set the Excel calendar (Windows 1900 or Mac 1904)
|
||||||
*
|
*
|
||||||
@ -172,7 +163,7 @@ class PHPExcel_Shared_Date
|
|||||||
$saveTimeZone = date_default_timezone_get();
|
$saveTimeZone = date_default_timezone_get();
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
$retValue = FALSE;
|
$retValue = FALSE;
|
||||||
if ((is_object($dateValue)) && ($dateValue instanceof self::$dateTimeObjectType)) {
|
if ((is_object($dateValue)) && ($dateValue instanceof DateTime)) {
|
||||||
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
|
$retValue = self::FormattedPHPToExcel( $dateValue->format('Y'), $dateValue->format('m'), $dateValue->format('d'),
|
||||||
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
$dateValue->format('H'), $dateValue->format('i'), $dateValue->format('s')
|
||||||
);
|
);
|
||||||
|
@ -70,13 +70,13 @@ class PHPExcel_Shared_OLERead {
|
|||||||
* Read the file
|
* Read the file
|
||||||
*
|
*
|
||||||
* @param $sFileName string Filename
|
* @param $sFileName string Filename
|
||||||
* @throws Exception
|
* @throws PHPExcel_Reader_Exception
|
||||||
*/
|
*/
|
||||||
public function read($sFileName)
|
public function read($sFileName)
|
||||||
{
|
{
|
||||||
// Check if file exists and is readable
|
// Check if file exists and is readable
|
||||||
if(!is_readable($sFileName)) {
|
if(!is_readable($sFileName)) {
|
||||||
throw new Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
|
throw new PHPExcel_Reader_Exception("Could not open " . $sFileName . " for reading! File does not exist, or it is not readable.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the file data
|
// Get the file data
|
||||||
@ -84,7 +84,7 @@ class PHPExcel_Shared_OLERead {
|
|||||||
|
|
||||||
// Check OLE identifier
|
// Check OLE identifier
|
||||||
if (substr($this->data, 0, 8) != self::IDENTIFIER_OLE) {
|
if (substr($this->data, 0, 8) != self::IDENTIFIER_OLE) {
|
||||||
throw new Exception('The filename ' . $sFileName . ' is not recognised as an OLE file');
|
throw new PHPExcel_Reader_Exception('The filename ' . $sFileName . ' is not recognised as an OLE file');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Total number of sectors used for the SAT
|
// Total number of sectors used for the SAT
|
||||||
|
@ -2782,7 +2782,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
|
|||||||
} elseif ($key == '_drawingCollection') {
|
} elseif ($key == '_drawingCollection') {
|
||||||
$newCollection = clone $this->_drawingCollection;
|
$newCollection = clone $this->_drawingCollection;
|
||||||
$this->_drawingCollection = $newCollection;
|
$this->_drawingCollection = $newCollection;
|
||||||
} elseif (($key == '_autoFilter') && (is_a($this->_autoFilter,'PHPExcel_Worksheet_AutoFilter'))) {
|
} elseif (($key == '_autoFilter') && ($this->_autoFilter instanceof PHPExcel_Worksheet_AutoFilter)) {
|
||||||
$newAutoFilter = clone $this->_autoFilter;
|
$newAutoFilter = clone $this->_autoFilter;
|
||||||
$this->_autoFilter = $newAutoFilter;
|
$this->_autoFilter = $newAutoFilter;
|
||||||
$this->_autoFilter->setParent($this);
|
$this->_autoFilter->setParent($this);
|
||||||
|
@ -30,7 +30,7 @@ $inputFileName = './sampleData/example_1.xls';
|
|||||||
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
|
echo 'Loading file ',pathinfo($inputFileName,PATHINFO_BASENAME),' using IOFactory to identify the format<br />';
|
||||||
try {
|
try {
|
||||||
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
|
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
|
||||||
} catch(Exception $e) {
|
} catch(PHPExcel_Reader_Exception $e) {
|
||||||
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
|
die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Binary file not shown.
@ -24,9 +24,11 @@
|
|||||||
|
|
||||||
|
|
||||||
Fixed in develop branch:
|
Fixed in develop branch:
|
||||||
- Bugfix: (Asker) Work item 18777 - Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check)
|
- Bugfix: (Asker) Work item 18777 - Error in PHPEXCEL/Calculation.php script on line 2976 (stack pop check)
|
||||||
- Bugfix: (MBaker) Work item 18794 - CSV files without a file extension being identified as HTML
|
- Bugfix: (MBaker) Work item 18794 - CSV files without a file extension being identified as HTML
|
||||||
- Bugfix: (MBaker) Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer
|
- Bugfix: (MBaker) Work item GH-66 - Wrong check for maximum number of rows in Excel5 Writer
|
||||||
|
- General: (kea) Improved AdvancedValueBinder for currency
|
||||||
|
- Bugfix: (techhead) Work item GH-70 - Fixed formula/formatting bug when removing rows
|
||||||
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user