Feature: Work item 14979 - Added listWorksheetNames() method to Excel2003XML Reader, and fixed a namespace bug
git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@66085 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
parent
14cc952323
commit
c644f9816c
|
@ -206,6 +206,34 @@ 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
|
||||||
|
*
|
||||||
|
* @param string $pFilename
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function listWorksheetNames($pFilename)
|
||||||
|
{
|
||||||
|
// Check if file exists
|
||||||
|
if (!file_exists($pFilename)) {
|
||||||
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$worksheetNames = array();
|
||||||
|
|
||||||
|
$xml = simplexml_load_file($pFilename);
|
||||||
|
$namespaces = $xml->getNamespaces(true);
|
||||||
|
|
||||||
|
$xml_ss = $xml->children($namespaces['ss']);
|
||||||
|
foreach($xml_ss->Worksheet as $worksheet) {
|
||||||
|
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||||
|
$worksheetNames[] = $worksheet_ss['Name'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $worksheetNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
|
@ -512,9 +540,10 @@ class PHPExcel_Reader_Excel2003XML implements PHPExcel_Reader_IReader
|
||||||
// echo '<hr />';
|
// echo '<hr />';
|
||||||
|
|
||||||
$worksheetID = 0;
|
$worksheetID = 0;
|
||||||
foreach($xml->Worksheet as $worksheet) {
|
$xml_ss = $xml->children($namespaces['ss']);
|
||||||
|
foreach($xml_ss->Worksheet as $worksheet) {
|
||||||
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
$worksheet_ss = $worksheet->attributes($namespaces['ss']);
|
||||||
// echo $worksheet_ss['Name'],'<br />';
|
|
||||||
if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) &&
|
if ((isset($this->_loadSheetsOnly)) && (isset($worksheet_ss['Name'])) &&
|
||||||
(!in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) {
|
(!in_array($worksheet_ss['Name'], $this->_loadSheetsOnly))) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
Fixed in SVN:
|
Fixed in SVN:
|
||||||
- Feature: (MBaker) Provide option to use PCLZip as an alternative to ZipArchive.
|
- Feature: (MBaker) Provide option to use PCLZip as an alternative to ZipArchive.
|
||||||
This allows the writing of Excel2007 files, even without ZipArchive enabled (it does require zlib), or when php_zip is one of the buggy PHP 5.2.6 or 5.2.8 versions
|
This allows the writing of Excel2007 files, even without ZipArchive enabled (it does require zlib), or when php_zip is one of the buggy PHP 5.2.6 or 5.2.8 versions
|
||||||
- Feature: (MBaker) Work item 14979 - Added listWorksheetNames() method to Excel2007, Excel5, OOCalc and Gnumeric Readers, allowing a user to extract a list of worksheet names from a file without parsing/loading the whole file.
|
- Feature: (MBaker) Work item 14979 - Added listWorksheetNames() method to Readers that support multiple worksheets in a workbook, allowing a user to extract a list of all the worksheet names from a file without parsing/loading the whole file.
|
||||||
- Bugfix: (MBaker) Work item 14888 - Simple =IF() formula disappears
|
- Bugfix: (MBaker) Work item 14888 - Simple =IF() formula disappears
|
||||||
- Bugfix: (MBaker) Work item 14898 - PHP Warning: preg_match(): Compilation failed: PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X
|
- Bugfix: (MBaker) Work item 14898 - PHP Warning: preg_match(): Compilation failed: PCRE does not support \\L, \\l, \\N, \\P, \\p, \\U, \\u, or \\X
|
||||||
- Bugfix: (MBaker) Work item 14901 - VLOOKUP choking on parameters in PHPExcel.1.7.5/PHPExcel_Writer_Excel2007
|
- Bugfix: (MBaker) Work item 14901 - VLOOKUP choking on parameters in PHPExcel.1.7.5/PHPExcel_Writer_Excel2007
|
||||||
|
|
Loading…
Reference in New Issue