AddedFeature: Work item 8769 - Implement Gnumeric File Format

Added Named Range handling to Gnumeric Reader


git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@60300 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2010-09-02 23:01:12 +00:00
parent b0c5c19ed3
commit da8bcea5b9

View File

@ -338,7 +338,6 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
} }
} }
$worksheetID = 0; $worksheetID = 0;
foreach($gnmXML->Sheets->Sheet as $sheet) { foreach($gnmXML->Sheets->Sheet as $sheet) {
$worksheetName = (string) $sheet->Name; $worksheetName = (string) $sheet->Name;
@ -414,6 +413,21 @@ class PHPExcel_Reader_Gnumeric implements PHPExcel_Reader_IReader
$worksheetID++; $worksheetID++;
} }
// Loop through definedNames
if (isset($gnmXML->Names)) {
foreach($gnmXML->Names->Name as $namedRange) {
$name = (string) $namedRange->name;
$range = (string) $namedRange->value;
$range = explode('!',$range);
$range[0] = trim($range[0],"'");;
if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
$extractedRange = str_replace('$', '', $range[1]);
$objPHPExcel->addNamedRange( new PHPExcel_NamedRange($name, $worksheet, $extractedRange) );
}
}
}
// Return // Return
return $objPHPExcel; return $objPHPExcel;