Commit Graph

4564 Commits

Author SHA1 Message Date
oleibman db602bde89 Merge branch 'master' into issue4001 2024-05-04 21:05:15 -07:00
oleibman 8485cd195f Merge pull request #4003 from oleibman/issue3999
Improvements to Xml Reader
2024-05-05 03:55:44 +00:00
oleibman 8441d3d899 Merge pull request #4011 from PHPOffice/dependabot/composer/phpstan/phpstan-1.10.67
Bump phpstan/phpstan from 1.10.66 to 1.10.67
2024-05-01 18:15:03 +00:00
oleibman e64d99a91f Merge branch 'master' into dependabot/composer/phpstan/phpstan-1.10.67 2024-05-01 10:57:17 -07:00
oleibman 18bc613ec8 Update Slk.php 2024-05-01 10:50:52 -07:00
dependabot[bot] f012091c81 Bump phpstan/phpstan from 1.10.66 to 1.10.67
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.66 to 1.10.67.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.10.66...1.10.67)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 17:49:27 +00:00
oleibman 13fe27182c Merge pull request #4012 from PHPOffice/dependabot/composer/tecnickcom/tcpdf-6.7.5
Bump tecnickcom/tcpdf from 6.7.4 to 6.7.5
2024-05-01 17:46:44 +00:00
oleibman ae59fe429e Merge pull request #4010 from PHPOffice/dependabot/composer/friendsofphp/php-cs-fixer-3.54.0
Bump friendsofphp/php-cs-fixer from 3.53.0 to 3.54.0
2024-05-01 17:45:38 +00:00
oleibman 1eaadb3643 Merge pull request #4009 from PHPOffice/dependabot/composer/squizlabs/php_codesniffer-3.9.2
Bump squizlabs/php_codesniffer from 3.9.1 to 3.9.2
2024-05-01 17:45:17 +00:00
oleibman 1d83e38ad1 Merge pull request #4008 from PHPOffice/dependabot/composer/dompdf/dompdf-2.0.8
Bump dompdf/dompdf from 2.0.4 to 2.0.8
2024-05-01 17:44:56 +00:00
dependabot[bot] 0543c1ff8d Bump tecnickcom/tcpdf from 6.7.4 to 6.7.5
Bumps [tecnickcom/tcpdf](https://github.com/tecnickcom/TCPDF) from 6.7.4 to 6.7.5.
- [Changelog](https://github.com/tecnickcom/TCPDF/blob/main/CHANGELOG.TXT)
- [Commits](https://github.com/tecnickcom/TCPDF/compare/6.7.4...6.7.5)

---
updated-dependencies:
- dependency-name: tecnickcom/tcpdf
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 11:42:11 +00:00
dependabot[bot] d0198b8720 Bump friendsofphp/php-cs-fixer from 3.53.0 to 3.54.0
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.53.0 to 3.54.0.
- [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases)
- [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.53.0...v3.54.0)

---
updated-dependencies:
- dependency-name: friendsofphp/php-cs-fixer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 11:41:59 +00:00
dependabot[bot] f19eac78d6 Bump squizlabs/php_codesniffer from 3.9.1 to 3.9.2
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.1...3.9.2)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 11:41:53 +00:00
dependabot[bot] 9167f00278 Bump dompdf/dompdf from 2.0.4 to 2.0.8
Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 2.0.4 to 2.0.8.
- [Release notes](https://github.com/dompdf/dompdf/releases)
- [Commits](https://github.com/dompdf/dompdf/compare/v2.0.4...v2.0.8)

---
updated-dependencies:
- dependency-name: dompdf/dompdf
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-01 11:41:48 +00:00
oleibman d40a1cfa52 Xml Reader Rich Text
Fix #4001. Thanks to @SlowFox71 who reported the problem and developed most of the solution. This PR adds Rich Text support to the XML reader. The Xml Spreadsheet stores Rich Text as Html tags, children of the ss:Data tag using a specific namespace. These can be parsed into a RichText object using existing method Helper/Html::toRichTextObject. There are 2 items which need special attention.

First, for attributes like bold or italic, Excel uses the appropriate Html tag (e.g. `<B>`). However, for an attribute like color, Excel uses `<Font html:Color="#FF0000">`, with a prefix on the Color tag. PhpSpreadsheet's Html parser cannot cope with the prefix. The parser is changed to strip `html:` from attribute names for the Font tag.

The example cited by the user used a `<BR />` to indicate a line break in the data. However, it appears that, at least some of the time, Excel will instead use `&#10;` to indicate a line break. The existing parser reduces one or more whitespace characters in the text to a single space, and so `&#10;` will wind up disappearing. I am not sure why the existing code does this, but I do know that I am not willing to break it. Instead, I've added an optional boolean parameter `$preserveWhiteSpace` to `toRichTextObject`. If false (default), the existing logic will be used; but if true, substitution for whitespace characters in the text will not happen.
2024-04-30 23:51:13 -07:00
oleibman 10ec62707e Improvements to Xml Reader
Fix #3999. Fix #4000. Fix #4002. Several bug reports and feature requests for Xml Reader arrived practically simultaneously. They are all small and hit the same code modules, so I have bundled them together in one PR.
- `loadSpreadsheetFromString` might try to open a file with a falsy name (like '0'), which results in an exception with a misleading message (or a completely unexpected result if a file with that name exists). Code will still throw an exception, but the message will no longer be misleading, and no file I/O will be attempted.
- function `trySimpleXmlLoadString` is deprecated. It should never have been implemented with public visibility, and the fact that it was made the fix above a little more difficult than it would otherwise have been. It is replaced with a private equivalent.
- Style reader function `parseStyles` will now use a better namespace-aware method of reading its Xml data. Peculiarly, the Xml for the Style elements can either include or not a namespace prefix. This is probably because the global namespace and the styles namespace are the same. The existing prefix-based code does not recognize their equivalence, but the new namespace-based code does. Xml Reader continues to use prefix-based code in several other places.
- Border line styles with Weight omitted or equal to 0 have been treated as no border, but they should be treated as 'hair' thickness.
- Support for Zoom is added to Xml Reader.
- In support of the above, new properties (and getters and setters) zoomScalePageLayoutView and zoomScaleSheetLayoutView are added to Worksheet/SheetView. (As far as I can tell, Excel does not support Sheet Layout View for Xml spreadsheets).
- Support is added for those new properties in Xlsx Reader and Writer.
- Xls Reader and Writer seem to work okay without changes. There is one test where Xls shows a different value for one of the properties than Xml or Xlsx, but the spreadsheet looks okay and I don't see any practical consequences of the difference.
- PageBreak support is added to Xml Reader.
- Code for writing out Column Page Breaks in Xlsx Writer was wrong (and, unsurprisingly, untested). A one-line change fixes it, and tests are added.
2024-04-27 16:42:42 -07:00
oleibman 34272571f5 Merge pull request #3992 from oleibman/issue3988
Table Filter Buttons
2024-04-20 14:32:03 +00:00
oleibman 98ab11cf5f Table Filter Buttons
Fix #3988. Excel allows a table to have some colums with filter buttons exposed and some with filter buttons hidden. However you cannot do this in "native" Excel - VBA is required for this feature. PhpSpreadsheet is supposed to be able to handle this, but Xlsx/Writer/Table had a bug. The `filterColumn` tags in the xml should be children of the `autoFilter` tag, but were generated as siblings. Moving one statement fixes that problem. Fixing that exposed another problem - autoFilter `showHideRows` was not properly recognizing that a filter could exist without any rules, which is what happens when a table filter button is hidden. Another simple change fixes that problem.

The parent issue correctly points out the problem for Column D in samples/Table/01_Table. However, that sample also has a problem with Column A - unlike columns B and C, there is a filter appled to column A, so its dropdown button should appear different than those in B and C. That problem is also corrected with the fixes above. I also added some formal tests based on that sample.
2024-04-17 10:45:58 -07:00
oleibman e9f03dfe36 Merge pull request #3946 from Phenix789/master
Fix default value for Conditional::$text
2024-04-17 02:27:33 +00:00
oleibman c84bdbf015 Add Test Case 2024-04-16 19:18:40 -07:00
oleibman 35030fa66d Merge pull request #3973 from Chris53897/patch-2
chore: fix ci deprcation (github pages)
2024-04-15 00:36:53 +00:00
oleibman a6b0405906 Merge pull request #3972 from Chris53897/patch-1
chore: fix ci deprecations
2024-04-15 00:36:30 +00:00
oleibman b732e55b61 Merge pull request #3984 from PHPOffice/dependabot/composer/friendsofphp/php-cs-fixer-3.53.0
Bump friendsofphp/php-cs-fixer from 3.51.0 to 3.53.0
2024-04-15 00:35:54 +00:00
oleibman df26a76a30 Update FunctionPrefix.php 2024-04-14 17:23:41 -07:00
dependabot[bot] 9c502b7d02 Bump friendsofphp/php-cs-fixer from 3.51.0 to 3.53.0
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.51.0 to 3.53.0.
- [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases)
- [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.51.0...v3.53.0)

---
updated-dependencies:
- dependency-name: friendsofphp/php-cs-fixer
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-15 00:23:24 +00:00
oleibman a076cfd00b Merge pull request #3970 from PHPOffice/dependabot/composer/squizlabs/php_codesniffer-3.9.1
Bump squizlabs/php_codesniffer from 3.9.0 to 3.9.1
2024-04-15 00:20:59 +00:00
oleibman 350162c938 Merge pull request #3971 from PHPOffice/dependabot/composer/mpdf/mpdf-8.2.3
Bump mpdf/mpdf from 8.2.2 to 8.2.3
2024-04-15 00:09:57 +00:00
oleibman 5748f3fe62 Merge pull request #3983 from PHPOffice/dependabot/composer/phpunit/phpunit-9.6.19
Bump phpunit/phpunit from 9.6.17 to 9.6.19
2024-04-15 00:08:39 +00:00
oleibman 0c0040840d Merge pull request #3966 from PHPOffice/dependabot/composer/phpstan/phpstan-1.10.66
Bump phpstan/phpstan from 1.10.59 to 1.10.66
2024-04-15 00:08:09 +00:00
oleibman e401743465 Merge pull request #3967 from PHPOffice/dependabot/composer/tecnickcom/tcpdf-6.7.4
Bump tecnickcom/tcpdf from 6.6.5 to 6.7.4
2024-04-14 23:35:38 +00:00
dependabot[bot] 40ccfb9b65 Bump phpunit/phpunit from 9.6.17 to 9.6.19
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.17 to 9.6.19.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.19/ChangeLog-9.6.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.17...9.6.19)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-14 23:29:32 +00:00
dependabot[bot] 419806484a Bump phpstan/phpstan from 1.10.59 to 1.10.66
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.10.59 to 1.10.66.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/1.11.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.10.59...1.10.66)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-14 23:29:25 +00:00
oleibman f7cf378fae Merge pull request #3957 from oleibman/htmlcomments
Html Writer Comments - Breaking Change
2024-04-14 23:24:47 +00:00
chris 8809fe1dd4 chore: fix ci deprcation (github pages) 2024-04-04 14:18:32 +02:00
chris 433b154764 chore: fix ci deprecations 2024-04-04 14:17:01 +02:00
dependabot[bot] 44accfd2d7 Bump mpdf/mpdf from 8.2.2 to 8.2.3
Bumps [mpdf/mpdf](https://github.com/mpdf/mpdf) from 8.2.2 to 8.2.3.
- [Release notes](https://github.com/mpdf/mpdf/releases)
- [Changelog](https://github.com/mpdf/mpdf/blob/development/CHANGELOG.md)
- [Commits](https://github.com/mpdf/mpdf/compare/v8.2.2...v8.2.3)

---
updated-dependencies:
- dependency-name: mpdf/mpdf
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 11:35:37 +00:00
dependabot[bot] 377895b965 Bump squizlabs/php_codesniffer from 3.9.0 to 3.9.1
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.0 to 3.9.1.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.9.0...3.9.1)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 11:35:33 +00:00
dependabot[bot] dac6c93295 Bump tecnickcom/tcpdf from 6.6.5 to 6.7.4
Bumps [tecnickcom/tcpdf](https://github.com/tecnickcom/TCPDF) from 6.6.5 to 6.7.4.
- [Changelog](https://github.com/tecnickcom/TCPDF/blob/main/CHANGELOG.TXT)
- [Commits](https://github.com/tecnickcom/TCPDF/commits/6.7.4)

---
updated-dependencies:
- dependency-name: tecnickcom/tcpdf
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-01 11:35:17 +00:00
oleibman f20688c179 Typo In Previous PR 2024-03-27 14:06:34 -07:00
oleibman c695d5ca8b Minor Correction
Sanitize font name.
2024-03-27 14:01:13 -07:00
oleibman e63e8a9bbf Merge pull request #3959 from oleibman/docrector
Update Rector Documentation
2024-03-25 02:22:10 +00:00
oleibman 6208887c12 Update Rector Documentation
Rector no longer supports conversion from PhpExcel (issue #3953). Documentation is updated to suggest using a non-current release of Rector for conversion.
2024-03-24 19:17:22 -07:00
oleibman 016ad4810e Merge pull request #3956 from oleibman/issue3951
Protect Sheet But Allow Sort
2024-03-25 00:55:00 +00:00
oleibman 6b09ee96b8 Update CHANGELOG.md 2024-03-24 17:50:26 -07:00
oleibman f64e0ecd79 Merge branch 'master' into issue3951 2024-03-24 17:40:54 -07:00
oleibman a9ac138300 Migration Aid
Provide a means for potentially affected users to test if new logic is in effect so that they can update code beforehand.
2024-03-21 08:53:13 -07:00
oleibman 989a4cec54 Html Writer Comments - Breaking Change
Fix #3954. In response to a Security Incident, a package was added to the project to sanitize the Html for comments attached to a cell. We have tried at least 2 different packages for this purpose, and users have raised legitimate concerns about both.

I believe that adding a sanitizer package, although it addresses the problem, was overkill. Cell comments are a RichText object, and Html Writer already handled RichText cell *values*. Values did not figure in the Incident, and they surely would have done so if they were a problem because it is a lot easier to set up test cases for values than for comments. RichText values were not a problem because they were sanitized with `htmlspecialchars`; if comments were to use the same code that RichText was already using, it would likewise be safely sanitized. As an added bonus, the existing code for comments only uses the plaintext value, but the values code would allow the comments to be styled, just as they are for Xlsx.

This is a breaking change - I don't think it will affect a lot of users, but there may be some. It is worth noting that the comment block before function `writeComment` has a link explaining what is being done. That link mentions only styling elements, not other possibilities like hyperlinks. At any rate, if people are putting styling tags (e.g. `<b>`) in their comments for this purpose, those will no longer work; the styling needs to be applied to the RichText elements. That will keep the user code the same regardless of the format of the intended output, which is certainly a good thing, but it is a break. If people are trying to insert non-styling tage (e.g. `<a>`), those will no longer work, just as there is no way to do it for Xlsx (although Excel itself may convert the raw text to a hyperlink, but that's out of scope, at least for now). I also note that, even with the current code, I haven't yet found a way to keep the Html comment in place long enough to actually click on any hyperlinks.

The main package being dropped brings several other packages along with it, so the project as a whole will have a slightly lighter footprint than before.

The existing `XssVulnerability` test cases are all preserved. Although the final result of the sanitizing changes, it can easily be seen that the results are all harmless.
2024-03-20 10:57:16 -07:00
oleibman 891180e13d Protect Sheet But Allow Sort
Fix #3951. When an Excel sheet is protected, even when sorting is explicitly allowed without a password, sorts are permitted only on "protected ranges" within the sheet. PhpSpreadsheet already supports protected ranges, and only minor tinkering is necessary for that (e.g. the protected range can have, but does not require, a password). The more important part of this change is documenting the far-from-intuitive way that Excel handles this. To that end, documentation is updated, and a new sample is added.

A new class, `Worksheet\ProtectedRange` is added in place of the string array which had been used. `Worksheet::getProtectedCells` is deprecated in favor of the new `Worksheet::getProtectedCellRanges`.
2024-03-20 07:04:24 -07:00
oleibman a6ef9a7b28 Merge pull request #3945 from oleibman/hidecol
Hidden Rows and Columns - Tcpdf and Mpdf
2024-03-19 21:09:54 +00:00
oleibman 8a1d424056 Merge pull request #3942 from oleibman/issue3935
Invalid Builtin Defined Name in Xls Reader
2024-03-19 21:05:40 +00:00