Skip to content

Commit

Permalink
FIX: PHPOffice#388 - supporting Microsoft x14 and xm extensions for d…
Browse files Browse the repository at this point in the history
…ataValidations.
  • Loading branch information
Frederic Delaunay committed Oct 29, 2018
1 parent 9cbb913 commit 1d1eb47
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/PhpSpreadsheet/Reader/Xlsx.php
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,21 @@ public function load($pFilename)
}

if ($xmlSheet && $xmlSheet->dataValidations && !$this->readDataOnly) {
// handle Microsoft extension if present
if (isset ($xmlSheet->extLst, $xmlSheet->extLst->ext, $xmlSheet->extLst->ext['uri'])
&& $xmlSheet->extLst->ext['uri'] == "{CCE6A557-97BC-4b89-ADB6-D9C93CAAB3DF}" )
{
// retreive MS extension data to create a node that matches expectations.
foreach ($xmlSheet->extLst->ext->children('x14', TRUE)->dataValidations->dataValidation as $item)
{
$node = $xmlSheet->dataValidations->addChild('dataValidation');
foreach ($item->attributes() as $attr)
$node->addAttribute($attr->getName(), $attr);
$node->addAttribute('sqref', $item->children('xm',TRUE)->sqref);
$node->addChild('formula1', $item->formula1->children('xm',TRUE)->f);
}
}

foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) {
// Uppercase coordinate
$range = strtoupper($dataValidation['sqref']);
Expand Down

0 comments on commit 1d1eb47

Please sign in to comment.