mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-23 13:56:05 +03:00
New Reader Feature: listWorksheetInfo() method added to Readers... courtesy of Christopher Mullins (schir1964)
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@88720 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
47c94fb28a
commit
63c411791e
@ -109,6 +109,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
*/
|
*/
|
||||||
private $_readFilter = null;
|
private $_readFilter = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_CSV
|
* Create a new PHPExcel_Reader_CSV
|
||||||
*/
|
*/
|
||||||
@ -116,6 +117,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
} // function __construct()
|
} // function __construct()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
*
|
*
|
||||||
@ -134,6 +136,126 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return true;
|
return true;
|
||||||
} // function canRead()
|
} // function canRead()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read filter
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
public function getReadFilter() {
|
||||||
|
return $this->_readFilter;
|
||||||
|
} // function getReadFilter()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read filter
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||||
|
*/
|
||||||
|
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||||
|
$this->_readFilter = $pValue;
|
||||||
|
return $this;
|
||||||
|
} // function setReadFilter()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set 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
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getInputEncoding()
|
||||||
|
{
|
||||||
|
return $this->_inputEncoding;
|
||||||
|
} // function getInputEncoding()
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetInfo($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open file
|
||||||
|
$fileHandle = fopen($pFilename, 'r');
|
||||||
|
if ($fileHandle === false) {
|
||||||
|
throw new Exception("Could not open file " . $pFilename . " for reading.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip BOM, if any
|
||||||
|
switch ($this->_inputEncoding) {
|
||||||
|
case 'UTF-8':
|
||||||
|
fgets($fileHandle, 4) == "\xEF\xBB\xBF" ?
|
||||||
|
fseek($fileHandle, 3) : fseek($fileHandle, 0);
|
||||||
|
break;
|
||||||
|
case 'UTF-16LE':
|
||||||
|
fgets($fileHandle, 3) == "\xFF\xFE" ?
|
||||||
|
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
||||||
|
break;
|
||||||
|
case 'UTF-16BE':
|
||||||
|
fgets($fileHandle, 3) == "\xFE\xFF" ?
|
||||||
|
fseek($fileHandle, 2) : fseek($fileHandle, 0);
|
||||||
|
break;
|
||||||
|
case 'UTF-32LE':
|
||||||
|
fgets($fileHandle, 5) == "\xFF\xFE\x00\x00" ?
|
||||||
|
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
||||||
|
break;
|
||||||
|
case 'UTF-32BE':
|
||||||
|
fgets($fileHandle, 5) == "\x00\x00\xFE\xFF" ?
|
||||||
|
fseek($fileHandle, 4) : fseek($fileHandle, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$escapeEnclosures = array( "\\" . $this->_enclosure, $this->_enclosure . $this->_enclosure );
|
||||||
|
|
||||||
|
$worksheetInfo = array();
|
||||||
|
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
|
||||||
|
$worksheetInfo[0]['lastColumnLetter'] = 'A';
|
||||||
|
$worksheetInfo[0]['lastColumnIndex'] = 0;
|
||||||
|
$worksheetInfo[0]['totalRows'] = 0;
|
||||||
|
$worksheetInfo[0]['totalColumns'] = 0;
|
||||||
|
|
||||||
|
// Loop through each line of the file in turn
|
||||||
|
while (($rowData = fgetcsv($fileHandle, 0, $this->_delimiter, $this->_enclosure)) !== FALSE) {
|
||||||
|
$worksheetInfo[0]['totalRows']++;
|
||||||
|
$worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
|
||||||
|
$worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
fclose($fileHandle);
|
||||||
|
|
||||||
|
return $worksheetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
@ -151,49 +273,6 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
} // function load()
|
} // function load()
|
||||||
|
|
||||||
/**
|
|
||||||
* Read filter
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @return PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
public function getReadFilter() {
|
|
||||||
return $this->_readFilter;
|
|
||||||
} // function getReadFilter()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read filter
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
|
||||||
*/
|
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
|
||||||
$this->_readFilter = $pValue;
|
|
||||||
return $this;
|
|
||||||
} // function setReadFilter()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set 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
|
|
||||||
*
|
|
||||||
* @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
|
||||||
@ -296,6 +375,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
} // function loadIntoExisting()
|
} // function loadIntoExisting()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get delimiter
|
* Get delimiter
|
||||||
*
|
*
|
||||||
@ -306,6 +386,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this->_delimiter;
|
return $this->_delimiter;
|
||||||
} // function getDelimiter()
|
} // function getDelimiter()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set delimiter
|
* Set delimiter
|
||||||
*
|
*
|
||||||
@ -318,6 +399,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
} // function setDelimiter()
|
} // function setDelimiter()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get enclosure
|
* Get enclosure
|
||||||
*
|
*
|
||||||
@ -328,6 +410,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this->_enclosure;
|
return $this->_enclosure;
|
||||||
} // function getEnclosure()
|
} // function getEnclosure()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set enclosure
|
* Set enclosure
|
||||||
*
|
*
|
||||||
@ -343,6 +426,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
} // function setEnclosure()
|
} // function setEnclosure()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get line ending
|
* Get line ending
|
||||||
*
|
*
|
||||||
@ -353,6 +437,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this->_lineEnding;
|
return $this->_lineEnding;
|
||||||
} // function getLineEnding()
|
} // function getLineEnding()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set line ending
|
* Set line ending
|
||||||
*
|
*
|
||||||
@ -365,6 +450,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
} // function setLineEnding()
|
} // function setLineEnding()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get sheet index
|
* Get sheet index
|
||||||
*
|
*
|
||||||
@ -375,6 +461,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this->_sheetIndex;
|
return $this->_sheetIndex;
|
||||||
} // function getSheetIndex()
|
} // function getSheetIndex()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set sheet index
|
* Set sheet index
|
||||||
*
|
*
|
||||||
@ -387,6 +474,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
} // function setSheetIndex()
|
} // function setSheetIndex()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Contiguous
|
* Set Contiguous
|
||||||
*
|
*
|
||||||
@ -403,6 +491,7 @@ class PHPExcel_Reader_CSV implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
} // function setInputEncoding()
|
} // function setInputEncoding()
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Contiguous
|
* Get Contiguous
|
||||||
*
|
*
|
||||||
|
@ -80,6 +80,14 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
private $_charSet = 'UTF-8';
|
private $_charSet = 'UTF-8';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Reader_Excel2003XML
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data only?
|
* Read data only?
|
||||||
*
|
*
|
||||||
@ -89,6 +97,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readDataOnly;
|
return $this->_readDataOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read data only
|
* Set read data only
|
||||||
*
|
*
|
||||||
@ -100,6 +109,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get which sheets to load
|
* Get which sheets to load
|
||||||
*
|
*
|
||||||
@ -110,6 +120,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $this->_loadSheetsOnly;
|
return $this->_loadSheetsOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set which sheets to load
|
* Set which sheets to load
|
||||||
*
|
*
|
||||||
@ -123,6 +134,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all sheets to load
|
* Set all sheets to load
|
||||||
*
|
*
|
||||||
@ -134,6 +146,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read filter
|
* Read filter
|
||||||
*
|
*
|
||||||
@ -143,6 +156,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readFilter;
|
return $this->_readFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read filter
|
* Set read filter
|
||||||
*
|
*
|
||||||
@ -154,12 +168,6 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new PHPExcel_Reader_Excel2003XML
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
@ -171,15 +179,15 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Office xmlns:o="urn:schemas-microsoft-com:office:office"
|
// Office xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||||
// Excel xmlns:x="urn:schemas-microsoft-com:office:excel"
|
// Excel xmlns:x="urn:schemas-microsoft-com:office:excel"
|
||||||
// XML Spreadsheet xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
// XML Spreadsheet xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
|
||||||
// Spreadsheet component xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"
|
// Spreadsheet component xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"
|
||||||
// XML schema xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
|
// XML schema xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
|
||||||
// XML data type xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
|
// XML data type xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
|
||||||
// MS-persist recordset xmlns:rs="urn:schemas-microsoft-com:rowset"
|
// MS-persist recordset xmlns:rs="urn:schemas-microsoft-com:rowset"
|
||||||
// Rowset xmlns:z="#RowsetSchema"
|
// Rowset xmlns:z="#RowsetSchema"
|
||||||
//
|
//
|
||||||
|
|
||||||
$signature = array(
|
$signature = array(
|
||||||
'<?xml version="1.0"',
|
'<?xml version="1.0"',
|
||||||
@ -214,6 +222,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $valid;
|
return $valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@ -245,6 +254,77 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetInfo($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetInfo = array();
|
||||||
|
|
||||||
|
$xml = simplexml_load_file($pFilename);
|
||||||
|
$namespaces = $xml->getNamespaces(true);
|
||||||
|
|
||||||
|
$worksheetID = 1;
|
||||||
|
$xml_ss = $xml->children($namespaces['ss']);
|
||||||
|
foreach($xml_ss->Worksheet as $worksheet) {
|
||||||
|
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||||
|
|
||||||
|
$tmpInfo = array();
|
||||||
|
$tmpInfo['worksheetName'] = '';
|
||||||
|
$tmpInfo['lastColumnLetter'] = 'A';
|
||||||
|
$tmpInfo['lastColumnIndex'] = 0;
|
||||||
|
$tmpInfo['totalRows'] = 0;
|
||||||
|
$tmpInfo['totalColumns'] = 0;
|
||||||
|
|
||||||
|
if (isset($worksheet_ss['Name'])) {
|
||||||
|
$tmpInfo['worksheetName'] = (string) $worksheet_ss['Name'];
|
||||||
|
} else {
|
||||||
|
$tmpInfo['worksheetName'] = "Worksheet_{$worksheetID}";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($worksheet->Table->Row)) {
|
||||||
|
$rowIndex = 0;
|
||||||
|
|
||||||
|
foreach($worksheet->Table->Row as $rowData) {
|
||||||
|
$columnIndex = 0;
|
||||||
|
$rowHasData = false;
|
||||||
|
|
||||||
|
foreach($rowData->Cell as $cell) {
|
||||||
|
if (isset($cell->Data)) {
|
||||||
|
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
||||||
|
$rowHasData = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
++$columnIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
++$rowIndex;
|
||||||
|
|
||||||
|
if ($rowHasData) {
|
||||||
|
$tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||||
|
$tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
||||||
|
|
||||||
|
$worksheetInfo[] = $tmpInfo;
|
||||||
|
++$worksheetID;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $worksheetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
@ -261,6 +341,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
||||||
$styleAttributeValue = strtolower($styleAttributeValue);
|
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||||
foreach($styleList as $style) {
|
foreach($styleList as $style) {
|
||||||
@ -272,6 +353,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pixel units to excel width units(units of 1/256th of a character width)
|
* pixel units to excel width units(units of 1/256th of a character width)
|
||||||
* @param pxs
|
* @param pxs
|
||||||
@ -285,6 +367,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $widthUnits;
|
return $widthUnits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* excel width units(units of 1/256th of a character width) to pixel units
|
* excel width units(units of 1/256th of a character width) to pixel units
|
||||||
* @param widthUnits
|
* @param widthUnits
|
||||||
@ -302,6 +385,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return chr(hexdec($hex[1]));
|
return chr(hexdec($hex[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
@ -802,6 +886,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _convertStringEncoding($string,$charset) {
|
private static function _convertStringEncoding($string,$charset) {
|
||||||
if ($charset != 'UTF-8') {
|
if ($charset != 'UTF-8') {
|
||||||
return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset);
|
return PHPExcel_Shared_String::ConvertEncoding($string,'UTF-8',$charset);
|
||||||
@ -809,6 +894,7 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function _parseRichText($is = '') {
|
private function _parseRichText($is = '') {
|
||||||
$value = new PHPExcel_RichText();
|
$value = new PHPExcel_RichText();
|
||||||
|
|
||||||
|
@ -91,6 +91,15 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
private static $_theme = null;
|
private static $_theme = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Reader_Excel2007 instance
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
|
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data only?
|
* Read data only?
|
||||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||||
@ -102,6 +111,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readDataOnly;
|
return $this->_readDataOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read data only
|
* Set read data only
|
||||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||||
@ -116,6 +126,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read charts in workbook?
|
* Read charts in workbook?
|
||||||
* If this is true, then the Reader will include any charts that exist in the workbook.
|
* If this is true, then the Reader will include any charts that exist in the workbook.
|
||||||
@ -128,6 +139,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_includeCharts;
|
return $this->_includeCharts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read charts in workbook
|
* Set read charts in workbook
|
||||||
* Set to true, to advise the Reader to include any charts that exist in the workbook.
|
* Set to true, to advise the Reader to include any charts that exist in the workbook.
|
||||||
@ -143,6 +155,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get which sheets to load
|
* Get which sheets to load
|
||||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||||
@ -155,6 +168,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_loadSheetsOnly;
|
return $this->_loadSheetsOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set which sheets to load
|
* Set which sheets to load
|
||||||
*
|
*
|
||||||
@ -171,6 +185,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all sheets to load
|
* Set all sheets to load
|
||||||
* Tells the Reader to load all worksheets from the workbook.
|
* Tells the Reader to load all worksheets from the workbook.
|
||||||
@ -183,6 +198,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read filter
|
* Read filter
|
||||||
*
|
*
|
||||||
@ -192,6 +208,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readFilter;
|
return $this->_readFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read filter
|
* Set read filter
|
||||||
*
|
*
|
||||||
@ -203,13 +220,6 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new PHPExcel_Reader_Excel2007 instance
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
|
||||||
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
@ -254,6 +264,82 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $xl;
|
return $xl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetInfo($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetInfo = array();
|
||||||
|
|
||||||
|
$zip = new ZipArchive;
|
||||||
|
$zip->open($pFilename);
|
||||||
|
|
||||||
|
$rels = simplexml_load_string($this->_getFromZipArchive($zip, "_rels/.rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
|
foreach ($rels->Relationship as $rel) {
|
||||||
|
if ($rel["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
|
||||||
|
$dir = dirname($rel["Target"]);
|
||||||
|
$relsWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/_rels/" . basename($rel["Target"]) . ".rels")); //~ http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
|
$relsWorkbook->registerXPathNamespace("rel", "http://schemas.openxmlformats.org/package/2006/relationships");
|
||||||
|
|
||||||
|
$worksheets = array();
|
||||||
|
foreach ($relsWorkbook->Relationship as $ele) {
|
||||||
|
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
|
||||||
|
$worksheets[(string) $ele["Id"]] = $ele["Target"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$xmlWorkbook = simplexml_load_string($this->_getFromZipArchive($zip, "{$rel['Target']}")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
|
if ($xmlWorkbook->sheets) {
|
||||||
|
$dir = dirname($rel["Target"]);
|
||||||
|
foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
|
||||||
|
$tmpInfo = array();
|
||||||
|
$tmpInfo['worksheetName'] = (string) $eleSheet["name"];
|
||||||
|
$tmpInfo['lastColumnLetter'] = 'A';
|
||||||
|
$tmpInfo['lastColumnIndex'] = 0;
|
||||||
|
$tmpInfo['totalRows'] = 0;
|
||||||
|
$tmpInfo['totalColumns'] = 0;
|
||||||
|
|
||||||
|
$fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
|
||||||
|
$xmlSheet = simplexml_load_string($this->_getFromZipArchive($zip, "$dir/$fileWorksheet")); //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
|
||||||
|
if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) {
|
||||||
|
foreach ($xmlSheet->sheetData->row as $row) {
|
||||||
|
foreach ($row->c as $c) {
|
||||||
|
$r = (string) $c["r"];
|
||||||
|
$coordinates = PHPExcel_Cell::coordinateFromString($r);
|
||||||
|
|
||||||
|
$rowIndex = $coordinates[1];
|
||||||
|
$columnIndex = PHPExcel_Cell::columnIndexFromString($coordinates[0]) - 1;
|
||||||
|
|
||||||
|
$tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
|
||||||
|
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||||
|
$tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
||||||
|
|
||||||
|
$worksheetInfo[] = $tmpInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$zip->close();
|
||||||
|
|
||||||
|
return $worksheetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _castToBool($c) {
|
private static function _castToBool($c) {
|
||||||
// echo 'Initial Cast to Boolean<br />';
|
// echo 'Initial Cast to Boolean<br />';
|
||||||
$value = isset($c->v) ? (string) $c->v : null;
|
$value = isset($c->v) ? (string) $c->v : null;
|
||||||
@ -267,16 +353,19 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $value;
|
return $value;
|
||||||
} // function _castToBool()
|
} // function _castToBool()
|
||||||
|
|
||||||
|
|
||||||
private static function _castToError($c) {
|
private static function _castToError($c) {
|
||||||
// echo 'Initial Cast to Error<br />';
|
// echo 'Initial Cast to Error<br />';
|
||||||
return isset($c->v) ? (string) $c->v : null;;
|
return isset($c->v) ? (string) $c->v : null;;
|
||||||
} // function _castToError()
|
} // function _castToError()
|
||||||
|
|
||||||
|
|
||||||
private static function _castToString($c) {
|
private static function _castToString($c) {
|
||||||
// echo 'Initial Cast to String<br />';
|
// echo 'Initial Cast to String<br />';
|
||||||
return isset($c->v) ? (string) $c->v : null;;
|
return isset($c->v) ? (string) $c->v : null;;
|
||||||
} // function _castToString()
|
} // function _castToString()
|
||||||
|
|
||||||
|
|
||||||
private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
|
private function _castToFormula($c,$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
|
||||||
// echo '<font color="darkgreen">Formula</font><br />';
|
// echo '<font color="darkgreen">Formula</font><br />';
|
||||||
// echo '$c->f is '.$c->f.'<br />';
|
// echo '$c->f is '.$c->f.'<br />';
|
||||||
@ -325,6 +414,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function _getFromZipArchive(ZipArchive $archive, $fileName = '')
|
public function _getFromZipArchive(ZipArchive $archive, $fileName = '')
|
||||||
{
|
{
|
||||||
// Root-relative paths
|
// Root-relative paths
|
||||||
@ -344,6 +434,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $contents;
|
return $contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@ -1640,6 +1731,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $excel;
|
return $excel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _readColor($color, $background=false) {
|
private static function _readColor($color, $background=false) {
|
||||||
if (isset($color["rgb"])) {
|
if (isset($color["rgb"])) {
|
||||||
return (string)$color["rgb"];
|
return (string)$color["rgb"];
|
||||||
@ -1662,6 +1754,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return 'FF000000';
|
return 'FF000000';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _readStyle($docStyle, $style) {
|
private static function _readStyle($docStyle, $style) {
|
||||||
// format code
|
// format code
|
||||||
if (isset($style->numFmt)) {
|
if (isset($style->numFmt)) {
|
||||||
@ -1789,6 +1882,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _readBorder($docBorder, $eleBorder) {
|
private static function _readBorder($docBorder, $eleBorder) {
|
||||||
if (isset($eleBorder["style"])) {
|
if (isset($eleBorder["style"])) {
|
||||||
$docBorder->setBorderStyle((string) $eleBorder["style"]);
|
$docBorder->setBorderStyle((string) $eleBorder["style"]);
|
||||||
@ -1798,6 +1892,7 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function _parseRichText($is = null) {
|
private function _parseRichText($is = null) {
|
||||||
$value = new PHPExcel_RichText();
|
$value = new PHPExcel_RichText();
|
||||||
|
|
||||||
@ -1860,14 +1955,17 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function array_item($array, $key = 0) {
|
private static function array_item($array, $key = 0) {
|
||||||
return (isset($array[$key]) ? $array[$key] : null);
|
return (isset($array[$key]) ? $array[$key] : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function dir_add($base, $add) {
|
private static function dir_add($base, $add) {
|
||||||
return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
|
return preg_replace('~[^/]+/\.\./~', '', dirname($base) . "/$add");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function toCSSArray($style) {
|
private static function toCSSArray($style) {
|
||||||
$style = str_replace(array("\r","\n"), "", $style);
|
$style = str_replace(array("\r","\n"), "", $style);
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
const XLS_Type_XFEXT = 0x087d;
|
const XLS_Type_XFEXT = 0x087d;
|
||||||
const XLS_Type_UNKNOWN = 0xffff;
|
const XLS_Type_UNKNOWN = 0xffff;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data only?
|
* Read data only?
|
||||||
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
* Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
|
||||||
@ -402,6 +403,14 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
private $_sharedFormulaParts;
|
private $_sharedFormulaParts;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Reader_Excel5 instance
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data only?
|
* Read data only?
|
||||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||||
@ -414,6 +423,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readDataOnly;
|
return $this->_readDataOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read data only
|
* Set read data only
|
||||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||||
@ -429,6 +439,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get which sheets to load
|
* Get which sheets to load
|
||||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||||
@ -441,6 +452,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_loadSheetsOnly;
|
return $this->_loadSheetsOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set which sheets to load
|
* Set which sheets to load
|
||||||
*
|
*
|
||||||
@ -457,6 +469,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all sheets to load
|
* Set all sheets to load
|
||||||
* Tells the Reader to load all worksheets from the workbook.
|
* Tells the Reader to load all worksheets from the workbook.
|
||||||
@ -469,6 +482,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read filter
|
* Read filter
|
||||||
*
|
*
|
||||||
@ -478,6 +492,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readFilter;
|
return $this->_readFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read filter
|
* Set read filter
|
||||||
*
|
*
|
||||||
@ -489,12 +504,6 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new PHPExcel_Reader_Excel5 instance
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
@ -523,6 +532,7 @@ 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
|
||||||
*
|
*
|
||||||
@ -572,6 +582,100 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetInfo($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetInfo = array();
|
||||||
|
|
||||||
|
// Read the OLE file
|
||||||
|
$this->_loadOLE($pFilename);
|
||||||
|
|
||||||
|
// total byte size of Excel data (workbook global substream + sheet substreams)
|
||||||
|
$this->_dataSize = strlen($this->_data);
|
||||||
|
|
||||||
|
// initialize
|
||||||
|
$this->_pos = 0;
|
||||||
|
$this->_sheets = array();
|
||||||
|
|
||||||
|
// Parse Workbook Global Substream
|
||||||
|
while ($this->_pos < $this->_dataSize) {
|
||||||
|
$code = self::_GetInt2d($this->_data, $this->_pos);
|
||||||
|
|
||||||
|
switch ($code) {
|
||||||
|
case self::XLS_Type_BOF: $this->_readBof(); break;
|
||||||
|
case self::XLS_Type_SHEET: $this->_readSheet(); break;
|
||||||
|
case self::XLS_Type_EOF: $this->_readDefault(); break 2;
|
||||||
|
default: $this->_readDefault(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse the individual sheets
|
||||||
|
foreach ($this->_sheets as $sheet) {
|
||||||
|
|
||||||
|
if ($sheet['sheetType'] != 0x00) {
|
||||||
|
// 0x00: Worksheet
|
||||||
|
// 0x02: Chart
|
||||||
|
// 0x06: Visual Basic module
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpInfo = array();
|
||||||
|
$tmpInfo['worksheetName'] = $sheet['name'];
|
||||||
|
$tmpInfo['lastColumnLetter'] = 'A';
|
||||||
|
$tmpInfo['lastColumnIndex'] = 0;
|
||||||
|
$tmpInfo['totalRows'] = 0;
|
||||||
|
$tmpInfo['totalColumns'] = 0;
|
||||||
|
|
||||||
|
$this->_pos = $sheet['offset'];
|
||||||
|
|
||||||
|
while ($this->_pos <= $this->_dataSize - 4) {
|
||||||
|
$code = self::_GetInt2d($this->_data, $this->_pos);
|
||||||
|
|
||||||
|
switch ($code) {
|
||||||
|
case self::XLS_Type_RK:
|
||||||
|
case self::XLS_Type_LABELSST:
|
||||||
|
case self::XLS_Type_NUMBER:
|
||||||
|
case self::XLS_Type_FORMULA:
|
||||||
|
case self::XLS_Type_BOOLERR:
|
||||||
|
case self::XLS_Type_LABEL:
|
||||||
|
$length = self::_GetInt2d($this->_data, $this->_pos + 2);
|
||||||
|
$recordData = substr($this->_data, $this->_pos + 4, $length);
|
||||||
|
|
||||||
|
// move stream pointer to next record
|
||||||
|
$this->_pos += 4 + $length;
|
||||||
|
|
||||||
|
$rowIndex = self::_GetInt2d($recordData, 0) + 1;
|
||||||
|
$columnIndex = self::_GetInt2d($recordData, 2);
|
||||||
|
|
||||||
|
$tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
|
||||||
|
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
||||||
|
break;
|
||||||
|
case self::XLS_Type_BOF: $this->_readBof(); break;
|
||||||
|
case self::XLS_Type_EOF: $this->_readDefault(); break 2;
|
||||||
|
default: $this->_readDefault(); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||||
|
$tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
||||||
|
|
||||||
|
$worksheetInfo[] = $tmpInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $worksheetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
@ -1064,6 +1168,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_phpExcel;
|
return $this->_phpExcel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use OLE reader to extract the relevant data streams from the OLE file
|
* Use OLE reader to extract the relevant data streams from the OLE file
|
||||||
*
|
*
|
||||||
@ -1089,6 +1194,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// $this->_userDefinedProperties = $ole->getUserDefinedProperties();
|
// $this->_userDefinedProperties = $ole->getUserDefinedProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read summary information
|
* Read summary information
|
||||||
*/
|
*/
|
||||||
@ -1248,6 +1354,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read additional document summary information
|
* Read additional document summary information
|
||||||
*/
|
*/
|
||||||
@ -1406,6 +1513,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record.
|
* Reads a general type of BIFF record. Does nothing except for moving stream pointer forward to next record.
|
||||||
*/
|
*/
|
||||||
@ -1482,6 +1590,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TEXT Object record contains the text associated with a cell annotation.
|
* The TEXT Object record contains the text associated with a cell annotation.
|
||||||
*/
|
*/
|
||||||
@ -1521,6 +1630,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// echo '<br />';
|
// echo '<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read BOF
|
* Read BOF
|
||||||
*/
|
*/
|
||||||
@ -1560,6 +1670,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FILEPASS
|
* FILEPASS
|
||||||
*
|
*
|
||||||
@ -1582,6 +1693,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
throw new Exception('Cannot read encrypted file');
|
throw new Exception('Cannot read encrypted file');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CODEPAGE
|
* CODEPAGE
|
||||||
*
|
*
|
||||||
@ -1605,6 +1717,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_codepage = PHPExcel_Shared_CodePage::NumberToName($codepage);
|
$this->_codepage = PHPExcel_Shared_CodePage::NumberToName($codepage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DATEMODE
|
* DATEMODE
|
||||||
*
|
*
|
||||||
@ -1632,6 +1745,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a FONT record
|
* Read a FONT record
|
||||||
*/
|
*/
|
||||||
@ -1718,6 +1832,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FORMAT
|
* FORMAT
|
||||||
*
|
*
|
||||||
@ -1755,6 +1870,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* XF - Extended Format
|
* XF - Extended Format
|
||||||
*
|
*
|
||||||
@ -2048,6 +2164,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -2224,6 +2341,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read STYLE record
|
* Read STYLE record
|
||||||
*/
|
*/
|
||||||
@ -2264,6 +2382,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read PALETTE record
|
* Read PALETTE record
|
||||||
*/
|
*/
|
||||||
@ -2287,6 +2406,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SHEET
|
* SHEET
|
||||||
*
|
*
|
||||||
@ -2338,6 +2458,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read EXTERNALBOOK record
|
* Read EXTERNALBOOK record
|
||||||
*/
|
*/
|
||||||
@ -2401,6 +2522,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read EXTERNNAME record.
|
* Read EXTERNNAME record.
|
||||||
*/
|
*/
|
||||||
@ -2435,6 +2557,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read EXTERNSHEET record
|
* Read EXTERNSHEET record
|
||||||
*/
|
*/
|
||||||
@ -2463,6 +2586,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DEFINEDNAME
|
* DEFINEDNAME
|
||||||
*
|
*
|
||||||
@ -2525,6 +2649,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read MSODRAWINGGROUP record
|
* Read MSODRAWINGGROUP record
|
||||||
*/
|
*/
|
||||||
@ -2539,6 +2664,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_drawingGroupData .= $recordData;
|
$this->_drawingGroupData .= $recordData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SST - Shared String Table
|
* SST - Shared String Table
|
||||||
*
|
*
|
||||||
@ -2730,6 +2856,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// _getSplicedRecordData() takes care of moving current position in data stream
|
// _getSplicedRecordData() takes care of moving current position in data stream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read PRINTGRIDLINES record
|
* Read PRINTGRIDLINES record
|
||||||
*/
|
*/
|
||||||
@ -2748,6 +2875,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read DEFAULTROWHEIGHT record
|
* Read DEFAULTROWHEIGHT record
|
||||||
*/
|
*/
|
||||||
@ -2765,6 +2893,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_phpSheet->getDefaultRowDimension()->setRowHeight($height / 20);
|
$this->_phpSheet->getDefaultRowDimension()->setRowHeight($height / 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read SHEETPR record
|
* Read SHEETPR record
|
||||||
*/
|
*/
|
||||||
@ -2791,6 +2920,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_isFitToPages = (bool) ((0x0100 & self::_GetInt2d($recordData, 0)) >> 8);
|
$this->_isFitToPages = (bool) ((0x0100 & self::_GetInt2d($recordData, 0)) >> 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read HORIZONTALPAGEBREAKS record
|
* Read HORIZONTALPAGEBREAKS record
|
||||||
*/
|
*/
|
||||||
@ -2819,6 +2949,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read VERTICALPAGEBREAKS record
|
* Read VERTICALPAGEBREAKS record
|
||||||
*/
|
*/
|
||||||
@ -2846,6 +2977,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read HEADER record
|
* Read HEADER record
|
||||||
*/
|
*/
|
||||||
@ -2873,6 +3005,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read FOOTER record
|
* Read FOOTER record
|
||||||
*/
|
*/
|
||||||
@ -2899,6 +3032,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read HCENTER record
|
* Read HCENTER record
|
||||||
*/
|
*/
|
||||||
@ -2918,6 +3052,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read VCENTER record
|
* Read VCENTER record
|
||||||
*/
|
*/
|
||||||
@ -2937,6 +3072,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read LEFTMARGIN record
|
* Read LEFTMARGIN record
|
||||||
*/
|
*/
|
||||||
@ -2954,6 +3090,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read RIGHTMARGIN record
|
* Read RIGHTMARGIN record
|
||||||
*/
|
*/
|
||||||
@ -2971,6 +3108,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read TOPMARGIN record
|
* Read TOPMARGIN record
|
||||||
*/
|
*/
|
||||||
@ -2988,6 +3126,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read BOTTOMMARGIN record
|
* Read BOTTOMMARGIN record
|
||||||
*/
|
*/
|
||||||
@ -3005,6 +3144,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read PAGESETUP record
|
* Read PAGESETUP record
|
||||||
*/
|
*/
|
||||||
@ -3061,6 +3201,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PROTECT - Sheet protection (BIFF2 through BIFF8)
|
* PROTECT - Sheet protection (BIFF2 through BIFF8)
|
||||||
* if this record is omitted, then it also means no sheet protection
|
* if this record is omitted, then it also means no sheet protection
|
||||||
@ -3084,6 +3225,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_phpSheet->getProtection()->setSheet((bool)$bool);
|
$this->_phpSheet->getProtection()->setSheet((bool)$bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SCENPROTECT
|
* SCENPROTECT
|
||||||
*/
|
*/
|
||||||
@ -3107,6 +3249,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_phpSheet->getProtection()->setScenarios((bool)$bool);
|
$this->_phpSheet->getProtection()->setScenarios((bool)$bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OBJECTPROTECT
|
* OBJECTPROTECT
|
||||||
*/
|
*/
|
||||||
@ -3130,6 +3273,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_phpSheet->getProtection()->setObjects((bool)$bool);
|
$this->_phpSheet->getProtection()->setObjects((bool)$bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8)
|
* PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8)
|
||||||
*/
|
*/
|
||||||
@ -3148,6 +3292,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read DEFCOLWIDTH record
|
* Read DEFCOLWIDTH record
|
||||||
*/
|
*/
|
||||||
@ -3166,6 +3311,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read COLINFO record
|
* Read COLINFO record
|
||||||
*/
|
*/
|
||||||
@ -3217,6 +3363,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ROW
|
* ROW
|
||||||
*
|
*
|
||||||
@ -3285,6 +3432,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read RK record
|
* Read RK record
|
||||||
* This record represents a cell that contains an RK value
|
* This record represents a cell that contains an RK value
|
||||||
@ -3331,6 +3479,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read LABELSST record
|
* Read LABELSST record
|
||||||
* This record represents a cell that contains a string. It
|
* This record represents a cell that contains a string. It
|
||||||
@ -3409,6 +3558,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read MULRK record
|
* Read MULRK record
|
||||||
* This record represents a cell range containing RK value
|
* This record represents a cell range containing RK value
|
||||||
@ -3463,6 +3613,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read NUMBER record
|
* Read NUMBER record
|
||||||
* This record represents a cell that contains a
|
* This record represents a cell that contains a
|
||||||
@ -3504,6 +3655,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read FORMULA record + perhaps a following STRING record if formula result is a string
|
* Read FORMULA record + perhaps a following STRING record if formula result is a string
|
||||||
* This record contains the token array and the result of a
|
* This record contains the token array and the result of a
|
||||||
@ -3647,6 +3799,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a SHAREDFMLA record. This function just stores the binary shared formula in the reader,
|
* Read a SHAREDFMLA record. This function just stores the binary shared formula in the reader,
|
||||||
* which usually contains relative references.
|
* which usually contains relative references.
|
||||||
@ -3677,6 +3830,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a STRING record from current stream position and advance the stream pointer to next record
|
* Read a STRING record from current stream position and advance the stream pointer to next record
|
||||||
* This record is used for storing result from FORMULA record when it is a string, and
|
* This record is used for storing result from FORMULA record when it is a string, and
|
||||||
@ -3703,6 +3857,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read BOOLERR record
|
* Read BOOLERR record
|
||||||
* This record represents a Boolean value or error value
|
* This record represents a Boolean value or error value
|
||||||
@ -3761,6 +3916,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read MULBLANK record
|
* Read MULBLANK record
|
||||||
* This record represents a cell range of empty cells. All
|
* This record represents a cell range of empty cells. All
|
||||||
@ -3800,6 +3956,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// offset: 6; size 2; index to last column (not needed)
|
// offset: 6; size 2; index to last column (not needed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read LABEL record
|
* Read LABEL record
|
||||||
* This record represents a cell that contains a string. In
|
* This record represents a cell that contains a string. In
|
||||||
@ -3849,6 +4006,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read BLANK record
|
* Read BLANK record
|
||||||
*/
|
*/
|
||||||
@ -3880,6 +4038,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read MSODRAWING record
|
* Read MSODRAWING record
|
||||||
*/
|
*/
|
||||||
@ -3894,6 +4053,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_drawingData .= $recordData;
|
$this->_drawingData .= $recordData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read OBJ record
|
* Read OBJ record
|
||||||
*/
|
*/
|
||||||
@ -3938,6 +4098,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// echo '<br />';
|
// echo '<br />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read WINDOW2 record
|
* Read WINDOW2 record
|
||||||
*/
|
*/
|
||||||
@ -3973,6 +4134,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read SCL record
|
* Read SCL record
|
||||||
*/
|
*/
|
||||||
@ -3994,6 +4156,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_phpSheet->getSheetView()->setZoomScale($numerator * 100 / $denumerator);
|
$this->_phpSheet->getSheetView()->setZoomScale($numerator * 100 / $denumerator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read PANE record
|
* Read PANE record
|
||||||
*/
|
*/
|
||||||
@ -4021,6 +4184,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read SELECTION record. There is one such record for each pane in the sheet.
|
* Read SELECTION record. There is one such record for each pane in the sheet.
|
||||||
*/
|
*/
|
||||||
@ -4071,6 +4235,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function _includeCellRangeFiltered($cellRangeAddress)
|
private function _includeCellRangeFiltered($cellRangeAddress)
|
||||||
{
|
{
|
||||||
$includeCellRange = true;
|
$includeCellRange = true;
|
||||||
@ -4090,6 +4255,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $includeCellRange;
|
return $includeCellRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MERGEDCELLS
|
* MERGEDCELLS
|
||||||
*
|
*
|
||||||
@ -4117,6 +4283,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read HYPERLINK record
|
* Read HYPERLINK record
|
||||||
*/
|
*/
|
||||||
@ -4292,6 +4459,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read DATAVALIDATIONS record
|
* Read DATAVALIDATIONS record
|
||||||
*/
|
*/
|
||||||
@ -4304,6 +4472,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
$this->_pos += 4 + $length;
|
$this->_pos += 4 + $length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read DATAVALIDATION record
|
* Read DATAVALIDATION record
|
||||||
*/
|
*/
|
||||||
@ -4463,6 +4632,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read SHEETLAYOUT record. Stores sheet tab color information.
|
* Read SHEETLAYOUT record. Stores sheet tab color information.
|
||||||
*/
|
*/
|
||||||
@ -4502,6 +4672,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read SHEETPROTECTION record (FEATHEADR)
|
* Read SHEETPROTECTION record (FEATHEADR)
|
||||||
*/
|
*/
|
||||||
@ -4600,6 +4771,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// offset: 21; size: 2; not used
|
// offset: 21; size: 2; not used
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read RANGEPROTECTION record
|
* Read RANGEPROTECTION record
|
||||||
* Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification,
|
* Reading of this record is based on Microsoft Office Excel 97-2000 Binary File Format Specification,
|
||||||
@ -4662,6 +4834,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read IMDATA record
|
* Read IMDATA record
|
||||||
*/
|
*/
|
||||||
@ -4742,6 +4915,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
// _getSplicedRecordData() takes care of moving current position in data stream
|
// _getSplicedRecordData() takes care of moving current position in data stream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a free CONTINUE record. Free CONTINUE record may be a camouflaged MSODRAWING record
|
* Read a free CONTINUE record. Free CONTINUE record may be a camouflaged MSODRAWING record
|
||||||
* When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented.
|
* When MSODRAWING data on a sheet exceeds 8224 bytes, CONTINUE records are used instead. Undocumented.
|
||||||
@ -4833,6 +5007,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert formula structure into human readable Excel formula like 'A3+A5*5'
|
* Convert formula structure into human readable Excel formula like 'A3+A5*5'
|
||||||
*
|
*
|
||||||
@ -4871,6 +5046,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $this->_getFormulaFromData($formulaData, $additionalData, $baseCell);
|
return $this->_getFormulaFromData($formulaData, $additionalData, $baseCell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take formula data and additional data for formula and return human readable formula
|
* Take formula data and additional data for formula and return human readable formula
|
||||||
*
|
*
|
||||||
@ -4897,6 +5073,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $formulaString;
|
return $formulaString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Take array of tokens together with additional data for formula and return human readable formula
|
* Take array of tokens together with additional data for formula and return human readable formula
|
||||||
*
|
*
|
||||||
@ -5060,6 +5237,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $formulaString;
|
return $formulaString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch next token from binary formula data
|
* Fetch next token from binary formula data
|
||||||
*
|
*
|
||||||
@ -5625,6 +5803,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a cell address in BIFF8 e.g. 'A2' or '$A$2'
|
* Reads a cell address in BIFF8 e.g. 'A2' or '$A$2'
|
||||||
* section 3.3.4
|
* section 3.3.4
|
||||||
@ -5654,6 +5833,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $column . $row;
|
return $column . $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a cell address in BIFF8 for shared formulas. Uses positive and negative values for row and column
|
* Reads a cell address in BIFF8 for shared formulas. Uses positive and negative values for row and column
|
||||||
* to indicate offsets from a base cell
|
* to indicate offsets from a base cell
|
||||||
@ -5697,6 +5877,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $column . $row;
|
return $column . $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a cell range address in BIFF5 e.g. 'A2:B6' or 'A1'
|
* Reads a cell range address in BIFF5 e.g. 'A2:B6' or 'A1'
|
||||||
* always fixed range
|
* always fixed range
|
||||||
@ -5735,6 +5916,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return "$fc$fr:$lc$lr";
|
return "$fc$fr:$lc$lr";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a cell range address in BIFF8 e.g. 'A2:B6' or 'A1'
|
* Reads a cell range address in BIFF8 e.g. 'A2:B6' or 'A1'
|
||||||
* always fixed range
|
* always fixed range
|
||||||
@ -5773,6 +5955,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return "$fc$fr:$lc$lr";
|
return "$fc$fr:$lc$lr";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a cell range address in BIFF8 e.g. 'A2:B6' or '$A$2:$B$6'
|
* Reads a cell range address in BIFF8 e.g. 'A2:B6' or '$A$2:$B$6'
|
||||||
* there are flags indicating whether column/row index is relative
|
* there are flags indicating whether column/row index is relative
|
||||||
@ -5825,6 +6008,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return "$fc$fr:$lc$lr";
|
return "$fc$fr:$lc$lr";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a cell range address in BIFF8 for shared formulas. Uses positive and negative values for row and column
|
* Reads a cell range address in BIFF8 for shared formulas. Uses positive and negative values for row and column
|
||||||
* to indicate offsets from a base cell
|
* to indicate offsets from a base cell
|
||||||
@ -5907,6 +6091,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return "$fc$fr:$lc$lr";
|
return "$fc$fr:$lc$lr";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read BIFF8 cell range address list
|
* Read BIFF8 cell range address list
|
||||||
* section 2.5.15
|
* section 2.5.15
|
||||||
@ -5934,6 +6119,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read BIFF5 cell range address list
|
* Read BIFF5 cell range address list
|
||||||
* section 2.5.15
|
* section 2.5.15
|
||||||
@ -5961,6 +6147,7 @@ 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
|
||||||
@ -6018,6 +6205,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read BIFF8 constant value array from array data
|
* read BIFF8 constant value array from array data
|
||||||
* returns e.g. array('value' => '{1,2;3,4}', 'size' => 40}
|
* returns e.g. array('value' => '{1,2;3,4}', 'size' => 40}
|
||||||
@ -6056,6 +6244,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value'
|
* read BIFF8 constant value which may be 'Empty Value', 'Number', 'String Value', 'Boolean Value', 'Error Value'
|
||||||
* section 2.5.7
|
* section 2.5.7
|
||||||
@ -6106,6 +6295,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract RGB color
|
* Extract RGB color
|
||||||
* OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4
|
* OpenOffice.org's Documentation of the Microsoft Excel File Format, section 2.5.4
|
||||||
@ -6130,6 +6320,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return array('rgb' => $rgb);
|
return array('rgb' => $rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read byte string (8-bit string length)
|
* Read byte string (8-bit string length)
|
||||||
* OpenOffice documentation: 2.5.2
|
* OpenOffice documentation: 2.5.2
|
||||||
@ -6151,6 +6342,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read byte string (16-bit string length)
|
* Read byte string (16-bit string length)
|
||||||
* OpenOffice documentation: 2.5.2
|
* OpenOffice documentation: 2.5.2
|
||||||
@ -6173,6 +6365,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts an Excel Unicode short string (8-bit string length)
|
* Extracts an Excel Unicode short string (8-bit string length)
|
||||||
* OpenOffice documentation: 2.5.3
|
* OpenOffice documentation: 2.5.3
|
||||||
@ -6196,6 +6389,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extracts an Excel Unicode long string (16-bit string length)
|
* Extracts an Excel Unicode long string (16-bit string length)
|
||||||
* OpenOffice documentation: 2.5.3
|
* OpenOffice documentation: 2.5.3
|
||||||
@ -6219,6 +6413,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read Unicode string with no string length field, but with known character count
|
* Read Unicode string with no string length field, but with known character count
|
||||||
* this function is under construction, needs to support rich text, and Asian phonetic settings
|
* this function is under construction, needs to support rich text, and Asian phonetic settings
|
||||||
@ -6254,6 +6449,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert UTF-8 string to string surounded by double quotes. Used for explicit string tokens in formulas.
|
* Convert UTF-8 string to string surounded by double quotes. Used for explicit string tokens in formulas.
|
||||||
* Example: hello"world --> "hello""world"
|
* Example: hello"world --> "hello""world"
|
||||||
@ -6266,6 +6462,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return '"' . str_replace('"', '""', $value) . '"';
|
return '"' . str_replace('"', '""', $value) . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads first 8 bytes of a string and return IEEE 754 float
|
* Reads first 8 bytes of a string and return IEEE 754 float
|
||||||
*
|
*
|
||||||
@ -6295,6 +6492,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _GetIEEE754($rknum)
|
private static function _GetIEEE754($rknum)
|
||||||
{
|
{
|
||||||
if (($rknum & 0x02) != 0) {
|
if (($rknum & 0x02) != 0) {
|
||||||
@ -6320,6 +6518,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get UTF-8 string from (compressed or uncompressed) UTF-16 string
|
* Get UTF-8 string from (compressed or uncompressed) UTF-16 string
|
||||||
*
|
*
|
||||||
@ -6336,6 +6535,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE');
|
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', 'UTF-16LE');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert UTF-16 string in compressed notation to uncompressed form. Only used for BIFF8.
|
* Convert UTF-16 string in compressed notation to uncompressed form. Only used for BIFF8.
|
||||||
*
|
*
|
||||||
@ -6353,6 +6553,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return $uncompressedString;
|
return $uncompressedString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert string to UTF-8. Only used for BIFF5.
|
* Convert string to UTF-8. Only used for BIFF5.
|
||||||
*
|
*
|
||||||
@ -6364,6 +6565,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $this->_codepage);
|
return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $this->_codepage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read 16-bit unsigned integer
|
* Read 16-bit unsigned integer
|
||||||
*
|
*
|
||||||
@ -6376,6 +6578,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return ord($data[$pos]) | (ord($data[$pos+1]) << 8);
|
return ord($data[$pos]) | (ord($data[$pos+1]) << 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read 32-bit signed integer
|
* Read 32-bit signed integer
|
||||||
*
|
*
|
||||||
@ -6398,6 +6601,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24;
|
return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read color
|
* Read color
|
||||||
*
|
*
|
||||||
@ -6455,6 +6659,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get fill pattern from index
|
* Get fill pattern from index
|
||||||
* OpenOffice documentation: 2.5.12
|
* OpenOffice documentation: 2.5.12
|
||||||
@ -6488,6 +6693,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map error code, e.g. '#N/A'
|
* Map error code, e.g. '#N/A'
|
||||||
*
|
*
|
||||||
@ -6508,6 +6714,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map built-in color to RGB value
|
* Map built-in color to RGB value
|
||||||
*
|
*
|
||||||
@ -6531,6 +6738,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map color array from BIFF5 built-in color index
|
* Map color array from BIFF5 built-in color index
|
||||||
*
|
*
|
||||||
@ -6600,6 +6808,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map color array from BIFF8 built-in color index
|
* Map color array from BIFF8 built-in color index
|
||||||
*
|
*
|
||||||
@ -6669,6 +6878,7 @@ class PHPExcel_Reader_Excel5 implements PHPExcel_Reader_IReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function _parseRichText($is = '') {
|
private function _parseRichText($is = '') {
|
||||||
$value = new PHPExcel_RichText();
|
$value = new PHPExcel_RichText();
|
||||||
|
|
||||||
|
@ -85,6 +85,15 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
private $_readFilter = null;
|
private $_readFilter = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Reader_Gnumeric
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
|
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data only?
|
* Read data only?
|
||||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||||
@ -96,6 +105,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readDataOnly;
|
return $this->_readDataOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read data only
|
* Set read data only
|
||||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||||
@ -110,6 +120,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get which sheets to load
|
* Get which sheets to load
|
||||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||||
@ -122,6 +133,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $this->_loadSheetsOnly;
|
return $this->_loadSheetsOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set which sheets to load
|
* Set which sheets to load
|
||||||
*
|
*
|
||||||
@ -138,6 +150,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all sheets to load
|
* Set all sheets to load
|
||||||
* Tells the Reader to load all worksheets from the workbook.
|
* Tells the Reader to load all worksheets from the workbook.
|
||||||
@ -150,6 +163,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read filter
|
* Read filter
|
||||||
*
|
*
|
||||||
@ -159,6 +173,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readFilter;
|
return $this->_readFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read filter
|
* Set read filter
|
||||||
*
|
*
|
||||||
@ -170,13 +185,6 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new PHPExcel_Reader_Gnumeric
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
|
||||||
$this->_referenceHelper = PHPExcel_ReferenceHelper::getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
@ -209,6 +217,70 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetInfo($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$gFileData = $this->_gzfileGetContents($pFilename);
|
||||||
|
|
||||||
|
$xml = simplexml_load_string($gFileData);
|
||||||
|
$namespacesMeta = $xml->getNamespaces(true);
|
||||||
|
|
||||||
|
$gnmXML = $xml->children($namespacesMeta['gnm']);
|
||||||
|
|
||||||
|
$worksheetInfo = array();
|
||||||
|
|
||||||
|
foreach ($gnmXML->Sheets->Sheet as $sheet) {
|
||||||
|
$tmpInfo = array();
|
||||||
|
$tmpInfo['worksheetName'] = (string) $sheet->Name;
|
||||||
|
$tmpInfo['lastColumnLetter'] = 'A';
|
||||||
|
$tmpInfo['lastColumnIndex'] = 0;
|
||||||
|
$tmpInfo['totalRows'] = 0;
|
||||||
|
$tmpInfo['totalColumns'] = 0;
|
||||||
|
|
||||||
|
foreach ($sheet->Cells->Cell as $cell) {
|
||||||
|
$cellAttributes = $cell->attributes();
|
||||||
|
|
||||||
|
$rowIndex = (int) $cellAttributes->Row + 1;
|
||||||
|
$columnIndex = (int) $cellAttributes->Col;
|
||||||
|
|
||||||
|
$tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
|
||||||
|
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||||
|
$tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
||||||
|
|
||||||
|
$worksheetInfo[] = $tmpInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $worksheetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function _gzfileGetContents($filename) {
|
||||||
|
$file = @gzopen($filename, 'rb');
|
||||||
|
if ($file !== false) {
|
||||||
|
$data = '';
|
||||||
|
while (!gzeof($file)) {
|
||||||
|
$data .= gzread($file, 1024);
|
||||||
|
}
|
||||||
|
gzclose($file);
|
||||||
|
}
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
@ -225,17 +297,6 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _gzfileGetContents($filename) {
|
|
||||||
$file = @gzopen($filename, 'rb');
|
|
||||||
if ($file !== false) {
|
|
||||||
$data = '';
|
|
||||||
while (!gzeof($file)) {
|
|
||||||
$data .= gzread($file, 1024);
|
|
||||||
}
|
|
||||||
gzclose($file);
|
|
||||||
}
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
@ -839,6 +900,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _parseBorderAttributes($borderAttributes) {
|
private static function _parseBorderAttributes($borderAttributes) {
|
||||||
$styleArray = array();
|
$styleArray = array();
|
||||||
|
|
||||||
@ -894,6 +956,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $styleArray;
|
return $styleArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function _parseRichText($is = '') {
|
private function _parseRichText($is = '') {
|
||||||
$value = new PHPExcel_RichText();
|
$value = new PHPExcel_RichText();
|
||||||
|
|
||||||
@ -902,6 +965,7 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
|
|||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function _parseGnumericColour($gnmColour) {
|
private static function _parseGnumericColour($gnmColour) {
|
||||||
list($gnmR,$gnmG,$gnmB) = explode(':',$gnmColour);
|
list($gnmR,$gnmG,$gnmB) = explode(':',$gnmColour);
|
||||||
$gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2);
|
$gnmR = substr(str_pad($gnmR,4,'0',STR_PAD_RIGHT),0,2);
|
||||||
|
@ -76,6 +76,14 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
private $_readFilter = null;
|
private $_readFilter = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new PHPExcel_Reader_OOCalc
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read data only?
|
* Read data only?
|
||||||
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
|
||||||
@ -87,6 +95,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readDataOnly;
|
return $this->_readDataOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read data only
|
* Set read data only
|
||||||
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
|
||||||
@ -100,6 +109,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get which sheets to load
|
* Get which sheets to load
|
||||||
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
|
||||||
@ -112,6 +122,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $this->_loadSheetsOnly;
|
return $this->_loadSheetsOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set which sheets to load
|
* Set which sheets to load
|
||||||
*
|
*
|
||||||
@ -128,6 +139,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all sheets to load
|
* Set all sheets to load
|
||||||
* Tells the Reader to load all worksheets from the workbook.
|
* Tells the Reader to load all worksheets from the workbook.
|
||||||
@ -140,6 +152,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read filter
|
* Read filter
|
||||||
*
|
*
|
||||||
@ -149,6 +162,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $this->_readFilter;
|
return $this->_readFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set read filter
|
* Set read filter
|
||||||
*
|
*
|
||||||
@ -160,12 +174,6 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new PHPExcel_Reader_OOCalc
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
@ -200,6 +208,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
*
|
*
|
||||||
@ -252,6 +261,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
private static function identifyFixedStyleValue($styleList,&$styleAttributeValue) {
|
||||||
$styleAttributeValue = strtolower($styleAttributeValue);
|
$styleAttributeValue = strtolower($styleAttributeValue);
|
||||||
foreach($styleList as $style) {
|
foreach($styleList as $style) {
|
||||||
@ -263,6 +273,97 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetInfo($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetInfo = array();
|
||||||
|
|
||||||
|
$zip = new ZipArchive;
|
||||||
|
if ($zip->open($pFilename) === true) {
|
||||||
|
|
||||||
|
$xml = simplexml_load_string($zip->getFromName("content.xml"));
|
||||||
|
$namespacesContent = $xml->getNamespaces(true);
|
||||||
|
|
||||||
|
$workbook = $xml->children($namespacesContent['office']);
|
||||||
|
foreach($workbook->body->spreadsheet as $workbookData) {
|
||||||
|
$workbookData = $workbookData->children($namespacesContent['table']);
|
||||||
|
foreach($workbookData->table as $worksheetDataSet) {
|
||||||
|
$worksheetData = $worksheetDataSet->children($namespacesContent['table']);
|
||||||
|
$worksheetDataAttributes = $worksheetDataSet->attributes($namespacesContent['table']);
|
||||||
|
|
||||||
|
$tmpInfo = array();
|
||||||
|
$tmpInfo['worksheetName'] = $worksheetDataAttributes['name'];
|
||||||
|
$tmpInfo['lastColumnLetter'] = 'A';
|
||||||
|
$tmpInfo['lastColumnIndex'] = 0;
|
||||||
|
$tmpInfo['totalRows'] = 0;
|
||||||
|
$tmpInfo['totalColumns'] = 0;
|
||||||
|
|
||||||
|
$rowIndex = 0;
|
||||||
|
foreach ($worksheetData as $key => $rowData) {
|
||||||
|
$rowHasData = false;
|
||||||
|
|
||||||
|
switch ($key) {
|
||||||
|
case 'table-row' :
|
||||||
|
$columnIndex = 0;
|
||||||
|
|
||||||
|
foreach ($rowData as $key => $cellData) {
|
||||||
|
$cellHasData = false;
|
||||||
|
|
||||||
|
$cellDataText = $cellData->children($namespacesContent['text']);
|
||||||
|
$cellDataOfficeAttributes = $cellData->attributes($namespacesContent['office']);
|
||||||
|
if (isset($cellDataText->p)) {
|
||||||
|
switch ($cellDataOfficeAttributes['value-type']) {
|
||||||
|
case 'string' :
|
||||||
|
case 'boolean' :
|
||||||
|
case 'float' :
|
||||||
|
case 'date' :
|
||||||
|
case 'time' :
|
||||||
|
$cellHasData = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cellDataText = null;
|
||||||
|
$cellDataOfficeAttributes = null;
|
||||||
|
|
||||||
|
if ($cellHasData) {
|
||||||
|
$tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
|
||||||
|
$rowHasData = true;
|
||||||
|
}
|
||||||
|
++$columnIndex;
|
||||||
|
}
|
||||||
|
++$rowIndex;
|
||||||
|
|
||||||
|
if ($rowHasData) {
|
||||||
|
$tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||||
|
$tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
||||||
|
|
||||||
|
$worksheetInfo[] = $tmpInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $worksheetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
@ -589,6 +690,7 @@ class PHPExcel_Reader_OOCalc implements PHPExcel_Reader_IReader
|
|||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function _parseRichText($is = '') {
|
private function _parseRichText($is = '') {
|
||||||
$value = new PHPExcel_RichText();
|
$value = new PHPExcel_RichText();
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
*/
|
*/
|
||||||
private $_readFilter = null;
|
private $_readFilter = null;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_SYLK
|
* Create a new PHPExcel_Reader_SYLK
|
||||||
*/
|
*/
|
||||||
@ -86,6 +87,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
$this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current PHPExcel_Reader_IReader read the file?
|
||||||
*
|
*
|
||||||
@ -120,6 +122,123 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read filter
|
||||||
|
*
|
||||||
|
* @return PHPExcel_Reader_IReadFilter
|
||||||
|
*/
|
||||||
|
public function getReadFilter() {
|
||||||
|
return $this->_readFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read filter
|
||||||
|
*
|
||||||
|
* @param PHPExcel_Reader_IReadFilter $pValue
|
||||||
|
*/
|
||||||
|
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
||||||
|
$this->_readFilter = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set input encoding
|
||||||
|
*
|
||||||
|
* @param string $pValue Input encoding
|
||||||
|
*/
|
||||||
|
public function setInputEncoding($pValue = 'ANSI')
|
||||||
|
{
|
||||||
|
$this->_inputEncoding = $pValue;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get input encoding
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getInputEncoding()
|
||||||
|
{
|
||||||
|
return $this->_inputEncoding;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetInfo($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open file
|
||||||
|
$fileHandle = fopen($pFilename, 'r');
|
||||||
|
if ($fileHandle === false) {
|
||||||
|
throw new Exception("Could not open file " . $pFilename . " for reading.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetInfo = array();
|
||||||
|
$worksheetInfo[0]['worksheetName'] = 'Worksheet';
|
||||||
|
$worksheetInfo[0]['lastColumnLetter'] = 'A';
|
||||||
|
$worksheetInfo[0]['lastColumnIndex'] = 0;
|
||||||
|
$worksheetInfo[0]['totalRows'] = 0;
|
||||||
|
$worksheetInfo[0]['totalColumns'] = 0;
|
||||||
|
|
||||||
|
// Loop through file
|
||||||
|
$rowData = array();
|
||||||
|
|
||||||
|
// loop through one row (line) at a time in the file
|
||||||
|
$rowIndex = 0;
|
||||||
|
while (($rowData = fgets($fileHandle)) !== FALSE) {
|
||||||
|
$columnIndex = 0;
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
if ($dataType == 'C') {
|
||||||
|
// Read cell value data
|
||||||
|
foreach($rowData as $rowDatum) {
|
||||||
|
switch($rowDatum{0}) {
|
||||||
|
case 'C' :
|
||||||
|
case 'X' :
|
||||||
|
$columnIndex = substr($rowDatum,1) - 1;
|
||||||
|
break;
|
||||||
|
case 'R' :
|
||||||
|
case 'Y' :
|
||||||
|
$rowIndex = substr($rowDatum,1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetInfo[0]['totalRows'] = max($worksheetInfo[0]['totalRows'], $rowIndex);
|
||||||
|
$worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], $columnIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
|
||||||
|
$worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
|
||||||
|
|
||||||
|
// Close file
|
||||||
|
fclose($fileHandle);
|
||||||
|
|
||||||
|
return $worksheetInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
@ -136,45 +255,6 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Read filter
|
|
||||||
*
|
|
||||||
* @return PHPExcel_Reader_IReadFilter
|
|
||||||
*/
|
|
||||||
public function getReadFilter() {
|
|
||||||
return $this->_readFilter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set read filter
|
|
||||||
*
|
|
||||||
* @param PHPExcel_Reader_IReadFilter $pValue
|
|
||||||
*/
|
|
||||||
public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue) {
|
|
||||||
$this->_readFilter = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set input encoding
|
|
||||||
*
|
|
||||||
* @param string $pValue Input encoding
|
|
||||||
*/
|
|
||||||
public function setInputEncoding($pValue = 'ANSI')
|
|
||||||
{
|
|
||||||
$this->_inputEncoding = $pValue;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get input encoding
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getInputEncoding()
|
|
||||||
{
|
|
||||||
return $this->_inputEncoding;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
@ -393,6 +473,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $objPHPExcel;
|
return $objPHPExcel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get sheet index
|
* Get sheet index
|
||||||
*
|
*
|
||||||
@ -402,6 +483,7 @@ class PHPExcel_Reader_SYLK implements PHPExcel_Reader_IReader
|
|||||||
return $this->_sheetIndex;
|
return $this->_sheetIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set sheet index
|
* Set sheet index
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user