From c94539c86c9e2790656947b87d1aa1ef211a4584 Mon Sep 17 00:00:00 2001 From: CrazyBite Date: Mon, 3 Oct 2016 17:18:38 +0900 Subject: [PATCH] Fix reading print area with sheet name containing a comma --- src/PhpSpreadsheet/Reader/Excel2007.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PhpSpreadsheet/Reader/Excel2007.php b/src/PhpSpreadsheet/Reader/Excel2007.php index 1e86e2c6..cbfc340c 100644 --- a/src/PhpSpreadsheet/Reader/Excel2007.php +++ b/src/PhpSpreadsheet/Reader/Excel2007.php @@ -1700,7 +1700,7 @@ class Excel2007 extends BaseReader implements IReader } break; case '_xlnm.Print_Area': - $rangeSets = explode(',', $extractedRange); // FIXME: what if sheetname contains comma? + $rangeSets = preg_split("/'(.*?)'(?:![A-Z0-9]+:[A-Z0-9]+,?)/", $extractedRange, PREG_SPLIT_NO_EMPTY); $newRangeSets = []; foreach ($rangeSets as $rangeSet) { $range = explode('!', $rangeSet); // FIXME: what if sheetname contains exclamation mark? @@ -1829,7 +1829,6 @@ class Excel2007 extends BaseReader implements IReader ); $objChart = \PhpOffice\PhpSpreadsheet\Reader\Excel2007\Chart::readChart($chartElements, basename($chartEntryRef, '.xml')); -// if (isset($charts[$chartEntryRef])) { $chartPositionRef = $charts[$chartEntryRef]['sheet'] . '!' . $charts[$chartEntryRef]['id']; if (isset($chartDetails[$chartPositionRef])) {