Ensure that selected worksheet is correctly set from Gnumeric Reader
This commit is contained in:
parent
2af0b66f5f
commit
138638ad57
|
|
@ -13,7 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
|||
|
||||
### Changed
|
||||
|
||||
- Gnumeric Reader now loads number formatting for cells
|
||||
- Gnumeric Reader now loads number formatting for cells.
|
||||
- Gnumeric Reader now correctly identifies selected worksheet.
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
|
|
|||
|
|
@ -284,12 +284,8 @@ class Gnumeric extends BaseReader
|
|||
$row = (int) $cellAttributes->Row + 1;
|
||||
$column = (int) $cellAttributes->Col;
|
||||
|
||||
if ($row > $maxRow) {
|
||||
$maxRow = $row;
|
||||
}
|
||||
if ($column > $maxCol) {
|
||||
$maxCol = $column;
|
||||
}
|
||||
$maxRow = max($maxRow, $row);
|
||||
$maxCol = max($maxCol, $column);
|
||||
|
||||
$column = Coordinate::stringFromColumnIndex($column + 1);
|
||||
|
||||
|
|
@ -318,10 +314,21 @@ class Gnumeric extends BaseReader
|
|||
|
||||
$this->processDefinedNames($gnmXML);
|
||||
|
||||
$this->setSelectedSheet($gnmXML);
|
||||
|
||||
// Return
|
||||
return $this->spreadsheet;
|
||||
}
|
||||
|
||||
private function setSelectedSheet(SimpleXMLElement $gnmXML): void
|
||||
{
|
||||
if (isset($gnmXML->UIData)) {
|
||||
$attributes = self::testSimpleXml($gnmXML->UIData->attributes());
|
||||
$selectedSheet = (int) $attributes['SelectedTab'];
|
||||
$this->spreadsheet->setActiveSheetIndex($selectedSheet);
|
||||
}
|
||||
}
|
||||
|
||||
private function processMergedCells(?SimpleXMLElement $sheet): void
|
||||
{
|
||||
// Handle Merged Cells in this worksheet
|
||||
|
|
|
|||
Loading…
Reference in New Issue