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
|
### 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
|
### Deprecated
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -284,12 +284,8 @@ class Gnumeric extends BaseReader
|
||||||
$row = (int) $cellAttributes->Row + 1;
|
$row = (int) $cellAttributes->Row + 1;
|
||||||
$column = (int) $cellAttributes->Col;
|
$column = (int) $cellAttributes->Col;
|
||||||
|
|
||||||
if ($row > $maxRow) {
|
$maxRow = max($maxRow, $row);
|
||||||
$maxRow = $row;
|
$maxCol = max($maxCol, $column);
|
||||||
}
|
|
||||||
if ($column > $maxCol) {
|
|
||||||
$maxCol = $column;
|
|
||||||
}
|
|
||||||
|
|
||||||
$column = Coordinate::stringFromColumnIndex($column + 1);
|
$column = Coordinate::stringFromColumnIndex($column + 1);
|
||||||
|
|
||||||
|
|
@ -318,10 +314,21 @@ class Gnumeric extends BaseReader
|
||||||
|
|
||||||
$this->processDefinedNames($gnmXML);
|
$this->processDefinedNames($gnmXML);
|
||||||
|
|
||||||
|
$this->setSelectedSheet($gnmXML);
|
||||||
|
|
||||||
// Return
|
// Return
|
||||||
return $this->spreadsheet;
|
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
|
private function processMergedCells(?SimpleXMLElement $sheet): void
|
||||||
{
|
{
|
||||||
// Handle Merged Cells in this worksheet
|
// Handle Merged Cells in this worksheet
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue