From 84ba21400c5043b7bc68addbc7a6fc8ba7f6a2d7 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Sat, 4 Jul 2020 00:28:16 +0200 Subject: [PATCH] Fix datatype conversion for Gnumeric values --- src/PhpSpreadsheet/Reader/Gnumeric.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PhpSpreadsheet/Reader/Gnumeric.php b/src/PhpSpreadsheet/Reader/Gnumeric.php index d96d562e..8375b37e 100644 --- a/src/PhpSpreadsheet/Reader/Gnumeric.php +++ b/src/PhpSpreadsheet/Reader/Gnumeric.php @@ -436,18 +436,18 @@ class Gnumeric extends BaseReader { if (!$this->readDataOnly && isset($sheet->PrintInformation)) { $printInformation = $sheet->PrintInformation[0]; - $scale = $printInformation->Scale->attributes()['percentage']; + $scale = (string) $printInformation->Scale->attributes()['percentage']; $pageOrder = (string) $printInformation->order; $orientation = (string) $printInformation->orientation; - $horizontalCentered = (bool) $printInformation->hcenter; - $verticalCentered = (bool) $printInformation->vcenter; + $horizontalCentered = (string) $printInformation->hcenter->attributes()['value']; + $verticalCentered = (string) $printInformation->vcenter->attributes()['value']; $this->spreadsheet->getActiveSheet()->getPageSetup() ->setPageOrder($pageOrder === 'r_then_d' ? PageSetup::PAGEORDER_OVER_THEN_DOWN : PageSetup::PAGEORDER_DOWN_THEN_OVER) ->setScale((int) $scale) ->setOrientation($orientation ?? PageSetup::ORIENTATION_DEFAULT) - ->setHorizontalCentered($horizontalCentered) - ->setVerticalCentered($verticalCentered); + ->setHorizontalCentered((bool) $horizontalCentered) + ->setVerticalCentered((bool) $verticalCentered); } }