Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #9 from Dfred/PHPOffice#388-Xlsx_MSextensions
Browse files Browse the repository at this point in the history
PHPOffice#388 xlsx m sextensions
  • Loading branch information
billblume authored Jun 15, 2018
2 parents 41d18c9 + 5b38d3d commit 778affa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Added

- Xlsx reader supports MS x14 and xm extensions for dataValidations - [#388](https://github.com/PHPOffice/PhpSpreadsheet/issues/388)
- HTML writer creates a generator meta tag - [#312](https://github.com/PHPOffice/PhpSpreadsheet/issues/312)
- Support invalid zoom value in XLSX format - [#350](https://github.com/PHPOffice/PhpSpreadsheet/pull/350)
- Support for `_xlfn.` prefixed functions and `ISFORMULA`, `MODE.SNGL`, `STDEV.S`, `STDEV.P` - [#390](https://github.com/PHPOffice/PhpSpreadsheet/pull/390)
Expand Down
15 changes: 15 additions & 0 deletions src/PhpSpreadsheet/Reader/Xlsx.php
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,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 778affa

Please sign in to comment.