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

#388 xlsx m sextensions #9

Merged
merged 2 commits into from
Jun 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,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 @@ -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