Don't load invalid Print Area, because this will corrupt the internal print area definition, and break on Writing
This commit is contained in:
parent
7c1c896959
commit
924ec23eb0
|
|
@ -32,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
||||||
|
|
||||||
- Xls Reader resolving absolute named ranges to relative ranges [Issue #2826](https://github.com/PHPOffice/PhpSpreadsheet/issues/2826) [PR #2827](https://github.com/PHPOffice/PhpSpreadsheet/pull/2827)
|
- Xls Reader resolving absolute named ranges to relative ranges [Issue #2826](https://github.com/PHPOffice/PhpSpreadsheet/issues/2826) [PR #2827](https://github.com/PHPOffice/PhpSpreadsheet/pull/2827)
|
||||||
- Null value handling in the Excel Math/Trig PRODUCT() function [Issue #2833](https://github.com/PHPOffice/PhpSpreadsheet/issues/2833) [PR #2834](https://github.com/PHPOffice/PhpSpreadsheet/pull/2834)
|
- Null value handling in the Excel Math/Trig PRODUCT() function [Issue #2833](https://github.com/PHPOffice/PhpSpreadsheet/issues/2833) [PR #2834](https://github.com/PHPOffice/PhpSpreadsheet/pull/2834)
|
||||||
|
- Invalid Print Area defined in Xlsx corrupts internal storage of print area [Issue #2848](https://github.com/PHPOffice/PhpSpreadsheet/issues/2848) [PR #2849](https://github.com/PHPOffice/PhpSpreadsheet/pull/2849)
|
||||||
|
|
||||||
## 1.23.0 - 2022-04-24
|
## 1.23.0 - 2022-04-24
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1530,13 +1530,18 @@ class Xlsx extends BaseReader
|
||||||
$rangeSets = preg_split("/('?(?:.*?)'?(?:![A-Z0-9]+:[A-Z0-9]+)),?/", $extractedRange, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
$rangeSets = preg_split("/('?(?:.*?)'?(?:![A-Z0-9]+:[A-Z0-9]+)),?/", $extractedRange, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||||
$newRangeSets = [];
|
$newRangeSets = [];
|
||||||
foreach ($rangeSets as $rangeSet) {
|
foreach ($rangeSets as $rangeSet) {
|
||||||
[$sheetName, $rangeSet] = Worksheet::extractSheetTitle($rangeSet, true);
|
[, $rangeSet] = Worksheet::extractSheetTitle($rangeSet, true);
|
||||||
|
if (empty($rangeSet)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (strpos($rangeSet, ':') === false) {
|
if (strpos($rangeSet, ':') === false) {
|
||||||
$rangeSet = $rangeSet . ':' . $rangeSet;
|
$rangeSet = $rangeSet . ':' . $rangeSet;
|
||||||
}
|
}
|
||||||
$newRangeSets[] = str_replace('$', '', $rangeSet);
|
$newRangeSets[] = str_replace('$', '', $rangeSet);
|
||||||
}
|
}
|
||||||
$docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets));
|
if (count($newRangeSets) > 0) {
|
||||||
|
$docSheet->getPageSetup()->setPrintArea(implode(',', $newRangeSets));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue