Commit Graph

5173 Commits

Author SHA1 Message Date
oleibman dfd8f3c40f Merge branch 'master' into comppcre 2025-01-21 15:07:32 -08:00
oleibman 887109541e Merge pull request #4322 from oleibman/issue4316
Html Writer Allow mailto
2025-01-21 22:06:59 +00:00
oleibman d24325ba30 Update CHANGELOG.md 2025-01-21 14:04:16 -08:00
oleibman 5f1d86932f Merge branch 'master' into issue4316 2025-01-21 14:01:35 -08:00
oleibman 3f8fea0d20 Delete 2 No-longer-needed Comments 2025-01-21 11:03:07 -08:00
oleibman d433504631 Add Comp/Pcre Phpstan Extension
Eliminate a number of annotations.
2025-01-20 20:53:08 -08:00
oleibman fde46cf08e Merge pull request #4320 from oleibman/issue4319
Mpdf and Tcpdf Hidden Columns and Merged Cells
2025-01-20 05:13:01 +00:00
oleibman 12b1690c52 Update CHANGELOG.md 2025-01-19 21:09:37 -08:00
oleibman e1984c6f1b Merge branch 'master' into issue4319 2025-01-19 21:02:02 -08:00
oleibman f33a440822 Merge pull request #4317 from oleibman/crstyle
Get Style for Row or Column
2025-01-20 04:48:09 +00:00
oleibman a72b206950 Merge branch 'master' into crstyle 2025-01-19 20:45:42 -08:00
oleibman a6cd613073 Update CHANGELOG.md 2025-01-19 20:44:50 -08:00
oleibman 9b122cd028 Use Composer/Pcre Part 1 of Many
The native preg functions (preg_match, preg_replace, etc.) often require us to add a lot of useless boilerplate code to satisfy Phpstan, Scrutinizer, etc. Composer/Pcre offers us a way to remove that boilerplate, thereby giving us a cleaner codebase. I decided to try it on a few modules, and saw a result that clearly demonstrated the usefulness of doing this (aside from the cleaner codebase).

Sample 22_Reader_issue1767 reads an Xlsx spreadsheet with complex sheet names used in defined names, and writes it to Xlsx and Xls output files. When I changed Writer/Xls/Parser to use Composer/Pcre, this sample failed in many different places writing the Xls file. It turns out that some regexes were failing not because the string didn't match, but because the regex encountered "catastrophic backtracing". Composer/Pcre throws an exception when this happens; the native preg_match does return false, but we were not checking for that. The regexes in question are now changed to something which works, and formal unit tests are added for them. Finding this previously undetected error indicates that we should proceed with this change.

An alternative to using Composer/Pcre would be to test for false after all the preg calls. I have done this in the two samples changed with this PR. That seems adequate for a small number of changes, but it really just makes for more clutter considering the large number of regexps that we use in our code. I think Composer/Pcre is a better choice.

It isn't quite transparent. Composer forces all regexps to use PREG_UNMATCHED_AS_NULL, so some match fields will now be null instead of null-string (or non-existent if the unmatched field comes at the end). Our test suite doesn't report any problem (yet) due to this change, although Phpstan is sensitive to it. Several Phpstan annotations were eliminated due to this change, but some others are now needed.

It is not necessary to do this all at once. This PR addresses all the calls in Writer. I intend to address other components in several tickets.
2025-01-17 09:44:45 -08:00
oleibman f98fd239cf Merge pull request #4315 from oleibman/duplicatesheet
Add Spreadsheet Method for Duplicating Worksheet
2025-01-16 07:45:43 +00:00
oleibman c176cc4f2a Update CHANGELOG.md 2025-01-15 23:43:22 -08:00
oleibman 5b96bcc1e2 Merge pull request #4313 from oleibman/issue4311b
Ods Reader Sheet Names with Period in Addresses and Formulas
2025-01-16 07:28:44 +00:00
oleibman 9ca6846316 Update CHANGELOG.md 2025-01-15 23:26:08 -08:00
oleibman f8bf5087ff Merge branch 'master' into issue4311b 2025-01-15 23:22:32 -08:00
oleibman 6d11fd27b5 Html Writer Allow mailto
Fix #4316. A security patch white-listed the protocols that could be used in a hyperlink. This PR adds mailto to the list.
2025-01-15 07:38:36 -08:00
oleibman eacaa25dca Merge pull request #4321 from oleibman/docprop
Tweak One Test
2025-01-15 09:47:00 +00:00
oleibman d5e69e3686 Tweak One Test
Fluke failure in CI push.
2025-01-15 01:43:42 -08:00
oleibman b4c1a86fbc Mpdf and Tcpdf Hidden Columns and Merged Cells
Fix #4319. PR #3495 allowed Mpdf and Tcpdf to handle hidden rows and columns. The handling is a little off when merged cells are part of the output. The fix for Mpdf is pretty straightforward. Tcpdf is a little more convoluted. Dompdf and Html do not require a change. Unit tests are added for the same scenario for all of Mpdf, Tcpdf, Dompdf, and Html.
2025-01-14 22:30:01 -08:00
oleibman c878fa174f Merge branch 'master' into crstyle 2025-01-13 20:19:10 -08:00
oleibman 0fe14cfd5e Update recipes.md 2025-01-13 20:18:15 -08:00
oleibman 4b3b0d45ad Get Style for Row or Column
This is the second recent occasion where style for whole row or column is behaving unexpectedly (see issue #4285). For the earlier issue, a documentation update was made to show the preferred method of styling. Setting styles for row(s) or column(s) in that way will work just fine, however retrieving the style doesn't yield the expected result. Although that problem can be overcome with existing code, simpler methods are needed, and this PR adds methods getRowStyle and getColumnStyle to Worksheet. I will continue to investigate why this problem and the one from 4285 have unexpected results.
2025-01-13 19:55:15 -08:00
oleibman 7c1a65e17c Add Spreadsheet Method for Duplicating Worksheet
Cloning a worksheet attached to a spreadsheet creates a clone which is detached from the spreadsheet. This can have its uses, but I think it would also be useful to have the ability to duplicate the worksheet and keep the duplicate attached to the spreadsheet. You can do that in Excel and LibreOffice, and you can now do it in PhpSpreadsheet as well. The duplicated worksheet will come immediately after its source.

The worksheet being duplicated could be identified in a number of ways - by passing the worksheet itself to the new method, by passing the worksheet title, or by passing the index of the worksheet within the spreadsheet. For now, I am just implementing the one I think is most useful (title).
2025-01-11 22:20:40 -08:00
oleibman 949c799c35 Prepare for New Release 3.8.0 2025-01-11 19:48:58 -08:00
oleibman 4088381ccf Merge commit from fork 2025-01-11 18:00:07 -08:00
oleibman 3d98d34b8e Ods Reader Sheet Names with Period in Addresses and Formulas
Fix #4311. Period is a valid character in a sheet name. When a sheet with such a name is referenced in Ods format, the sheet name must be enclosed in apostrophes, because Ods uses period to separate sheet name from cell address. (Excel uses exclamation point so doesn't necessarily need to enclose the sheet name in apostrophes.) This causes a problem for the Ods Reader whenever it tries to parse such an address; however, the problem showed up specifically for auto filters, because the Ods xml for those specifies *'sheetname'.startcell:'sheetname'.endcell* (Excel omits sheetname).

Ods Reader translates these addresses in 2 different methods in FormulaTranslator. I had a relatively elegant method for handling this situation in convertToExcelAddressValue, but I could not make it work in convertToExcelFormulaValue. A kludgier method works for Formula, and also for Address. I decided it's better to be consistent, so I'm going with the kludgier method for both.

It would not surprise me in the least if there are similar problems lying in wait for other special characters in sheet names, and for other formats besides Ods. For now, I will limit myself to fixing the known problem.
2025-01-09 23:16:39 -08:00
oleibman 51b1d1c3a2 Merge pull request #4283 from oleibman/groupby
Extremely Limited Support for GROUPBY Function
2025-01-09 20:39:46 +00:00
oleibman bfcfaeea8e Update CHANGELOG.md 2025-01-08 15:04:47 -08:00
oleibman f25502d704 Merge branch 'master' into groupby 2025-01-08 14:53:51 -08:00
oleibman 7456b46805 Merge pull request #4300 from oleibman/license
Update License
2025-01-08 22:42:51 +00:00
oleibman f5c285ead9 Merge pull request #4302 from oleibman/issue641
Retitling Cloned Worksheets
2025-01-08 22:32:09 +00:00
oleibman decc0a4d09 Update CHANGELOG.md 2025-01-08 14:29:38 -08:00
oleibman 17706a9e1d Merge pull request #4310 from oleibman/issue4309
getStyle Accept RowRange or ColumnRange Using Phpstan
2025-01-08 01:24:19 +00:00
oleibman 77f3f17ee8 getStyle Accept RowRange or ColumnRange Using Phpstan
Fix #4309. No executable source code is changed, just some doc blocks, and some new tests added.
2025-01-07 16:49:37 -08:00
oleibman 0ecf9c2273 Eliminate Unneeded Statement 2025-01-06 16:59:04 -08:00
oleibman ac5d3706a4 Add Parameter retitleIfNeeded to AddSheet
A little more useful than my first crack at this.
2025-01-06 16:56:53 -08:00
oleibman dcc25637f2 Retitling Cloned Worksheets
Fix #641 (marked stale in 2018, but now reopened). When a sheet's title is changed, PhpSpreadsheet updates references to the old sheet name found in formulas. Which is a good idea when the sheet is attached to the spreadsheet, but a bad idea when it isn't (often because it has been cloned without re-attaching to the spreadsheet). This PR continues to change formulas in the former case, but will no longer do so for the latter.
2025-01-05 22:40:29 -08:00
oleibman 27563525cc Update License
Someone opened a PR to do this a few days ago. I posted a comment. When I was ready to return to the ticket, I couldn't find it as opened or closed. It seemed like a reasonable idea. I will submit this PR for now and sit on it for about a week to give the original author a chance to resubmit.
2025-01-04 21:20:45 -08:00
oleibman c58a8e37bc Merge pull request #4289 from oleibman/doc4285
Document Styling Whole Columns and Rows
2025-01-03 01:23:55 +00:00
oleibman 483fd49c9e Merge pull request #4298 from oleibman/mitoupgrade
Upgrade mitoteam/jpgraph
2025-01-02 18:06:08 +00:00
oleibman 7e24333f72 Upgrade mitoteam/jpgraph
They have made a change at our request to help us eliminate runInSeparateProcess for one or more tests. This will be helpful when we get to PhpUnit 11 (not imminent, since it doesn't support Php8.1, but it will happen eventually).
2025-01-02 09:59:34 -08:00
oleibman fb757cfc5b Merge pull request #4297 from oleibman/updatefixer
Upgrade php-cs-fixer
2025-01-01 17:40:31 +00:00
oleibman 14c6446715 Upgrade php-cs-fixer
Dependabot wanted to do this (PR #4296), but code changes were needed to pass.
2025-01-01 09:26:41 -08:00
oleibman 22478638ae Merge pull request #4295 from PHPOffice/dependabot/composer/squizlabs/php_codesniffer-3.11.2
Bump squizlabs/php_codesniffer from 3.11.1 to 3.11.2
2025-01-01 16:15:40 +00:00
oleibman 91d8a27a0a Merge pull request #4294 from PHPOffice/dependabot/composer/dompdf/dompdf-3.0.2
Bump dompdf/dompdf from 3.0.1 to 3.0.2
2025-01-01 16:14:59 +00:00
dependabot[bot] eec2d9caaf Bump squizlabs/php_codesniffer from 3.11.1 to 3.11.2
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.11.1 to 3.11.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.11.1...3.11.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>
2025-01-01 11:43:41 +00:00
dependabot[bot] e68da428a4 Bump dompdf/dompdf from 3.0.1 to 3.0.2
Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/dompdf/dompdf/releases)
- [Commits](https://github.com/dompdf/dompdf/compare/v3.0.1...v3.0.2)

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

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-01 11:43:38 +00:00