Commit Graph

5712 Commits

Author SHA1 Message Date
oleibman e31c9246ed Merge pull request #4582 from oleibman/setaccessible
Remove Reflection::setAccessible From Tests
2025-08-18 06:43:32 +00:00
oleibman 029d79c3fc Remove Reflection::setAccessible From Tests
Method has no effect starting with Php 8.1.0, and will be deprecated in 8.5. Remove it from our test suite.
2025-08-17 23:21:17 -07:00
oleibman 3174773a81 Merge pull request #4580 from oleibman/issue1457
splitRange and ProtectedRange
2025-08-17 04:12:03 +00:00
oleibman ae1b517ff3 Update CHANGELOG.md 2025-08-16 21:09:21 -07:00
oleibman efa0c0fa73 Merge pull request #4577 from oleibman/issue1203
Copy Cell Adjusting Formula
2025-08-17 03:55:42 +00:00
oleibman 08f2f1bfd8 Merge pull request #4579 from oleibman/issue1637
Handle Google-only Formulas Exported from Google Sheets
2025-08-17 03:43:32 +00:00
oleibman fe1220110b Documentation Update 2025-08-16 20:32:08 -07:00
oleibman 653645c50b Merge pull request #4574 from issakujitsuk/icon-set
Add Conditional Formatting with IconSet
2025-08-17 03:01:08 +00:00
oleibman 14a989a7e3 Handle Missing Defined Names Better
The original issue leading to this PR was fixed by correctly treating a token in Calculator as a function rather than a defined name. However, it *should* have worked even when treating it as a defined name. There was a problem because Calculator was raising an exception for a missing defined name rather than returning `#NAME?`. It is now changed to return the error.

That change initially had some adverse affects for functions ROW, ROWS, COLUMN, and COLUMNS. Those are fixed to handle the change correctly. As a bonus, a test for each which had been commented out, because it didn't work, is now uncommented and works correctly. One test for ISFORMULA and one for ISREF were also changed - the old expected result did not reflect Excel's behavior and the new one does.

Sheet title and Defined Name matching used `strtoupper` to achieve case-insensitive compares. This handles only ASCII characters. They are changed to use a conversion routine which handles non-ASCII UTF-8 character sets.
2025-08-12 09:21:26 -07:00
oleibman 05fa51581c splitRange and ProtectedRange
Fix #1457, which had gone stale but is now re-opened. The `Coordinate::splitRange` method expects a string of cell ranges, but it is a bit limited. Excel sometimes uses comma for union and space for intersection, and sometimes vice versa. `splitRange` uses comma for union, and doesn't do anything with spaces. This PR adds a new method `Coordinate::allRanges` which handles both union and intersection, and adds a parameter to indicate whether comma means union or intersection (with space meaning the other). Also, since the issue specifically mentioned this as a problem for `ProtectedRange`, an `allRanges` method is added to that class.
2025-08-10 15:05:51 -07:00
oleibman f51ec365c5 Handle Google-only Formulas Exported from Google Sheets
Fix #1637, which went stale but is now re-opened. When Google Sheets exports a document to Xlsx or Ods, it replaces Google-only formulas with something that Excel or LibreOffice can handle. In the test case accompanying this PR, cell C1 on Google Sheets contains `=flatten(A1:A5,B1:B5)`. On export, C1:C10 (the actual result is a 10*1 array) are changed to `=IFERROR(__xludf.DUMMYFUNCTION("flatten(A1:A5, B1:B5)"),1.0)`, where `1.0` is replaced by the calculated value for each cell in question.

The issue reports an Internal Error when evaluating such a formula. I am unable to duplicate that. However, PhpSpreadsheet evaluates the cell as a `#NAME?` error rather than the correct value (1.0 for cell C1). The reason is that `__xludf.DUMMYFUNCTION` does not match the regexp for formulas, but does match the regexp for defined names. Not finding such a defined name results in the Name error. Altering the formula regexp to recognize `__xludf.` is easy, and solves the problem.
2025-08-10 14:45:05 -07:00
oleibman 1e6668fe58 Copy Cell Adjusting Formula
Fix #1203. The issue actually complains about the documentation, but I think it wants documented functionality that doesn't yet exist. This PR adds a method for copying a formula from one cell to another, adjusting cell references in the formula as Excel would. For a non-formula, it copies the value without making any adjustments.
2025-08-10 13:45:03 -07:00
oleibman d88efcac24 Merge pull request #4576 from oleibman/changelog20250810
Update Changelog for New Release
5.0.0
2025-08-10 06:18:27 +00:00
oleibman 44fe16575c Update Changelog for New Release 2025-08-09 23:12:30 -07:00
issa 782610d02b Add sample for Conditional Formatting with Icon Sets in Xlsx 2025-08-09 23:24:31 +09:00
issa a0f9706855 Add Conditional Formatting tests for IconSet in Xlsx writer 2025-08-09 08:06:19 +09:00
issa a3588b2c22 Add test for unsupported icon sets 2025-08-09 07:23:18 +09:00
oleibman 886a8c35c1 Merge pull request #4575 from oleibman/issue1324
Additional Floating Point Precision Changes
2025-08-08 03:35:45 +00:00
oleibman 0c8db6e7d2 Merge branch 'master' into issue1324 2025-08-07 20:33:00 -07:00
oleibman d1db7845cc Update CHANGELOG.md 2025-08-07 20:30:24 -07:00
oleibman 8d8bc23b6d Merge pull request #4572 from oleibman/issue484
Header/Footer Images Expand "Location"
2025-08-07 05:29:16 +00:00
oleibman a4ee68bf1e Merge branch 'master' into issue484 2025-08-06 22:26:24 -07:00
oleibman 3c67aba359 Update CHANGELOG.md 2025-08-06 22:24:24 -07:00
oleibman 216db02ad5 Merge pull request #4565 from oleibman/issue4588
Create Uninitialized Cell If Used in Calculation
2025-08-07 05:00:06 +00:00
oleibman fa2c32996a Merge branch 'master' into issue4588 2025-08-06 21:57:24 -07:00
oleibman 4b9a3cdef8 Update CHANGELOG.md 2025-08-06 21:54:11 -07:00
oleibman 7689037b60 Additional Floating Point Precision Changes
Fix #1324, which went stale many years ago, and is now re-opened. It can be considered a follow-on to PR #4479 which was installed in May. The user complains of a *very* small loss of precision. This can be corrected by using `StringHelper::convertToString` in lieu of a simple cast from float to string in two places. `Style\NumberFormat\Formatter` is quite straightforward. `Writer\Csv` is a bit more complicated. If you put a float with more than 15 digits precision in a Csv, on opening it Excel will give a pop-up, saying something inaccurate like "We've corrected this for you - is that okay?" Better to avoid that by making sure to avoid too much precision when writing to Csv.
2025-08-06 17:53:04 -07:00
issa 0327b49060 Added Conditional Formatting: IconSet for Xlsx (#4560) 2025-08-07 08:59:11 +09:00
oleibman ea97afb754 Merge pull request #4562 from oleibman/issue4557date
Shared/Date::isDateTime Handle Cells Which Calculate as Arrays
2025-08-06 07:16:44 +00:00
oleibman c4cd1b3410 Merge branch 'master' into issue4557date 2025-08-05 23:52:31 -07:00
oleibman 9a805fd7b2 Update CHANGELOG.md 2025-08-05 23:51:04 -07:00
oleibman a907f19462 Merge pull request #4573 from PHPOffice/dependabot/composer/setasign/fpdi-2.6.4
Bump setasign/fpdi from 2.6.3 to 2.6.4
2025-08-05 23:44:36 +00:00
dependabot[bot] 02b12603b7 Bump setasign/fpdi from 2.6.3 to 2.6.4
Bumps [setasign/fpdi](https://github.com/Setasign/FPDI) from 2.6.3 to 2.6.4.
- [Release notes](https://github.com/Setasign/FPDI/releases)
- [Commits](https://github.com/Setasign/FPDI/compare/v2.6.3...v2.6.4)

---
updated-dependencies:
- dependency-name: setasign/fpdi
  dependency-version: 2.6.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-05 21:26:16 +00:00
oleibman 9c083e271d Header/Footer Images Expand "Location"
Fix #484. Fix #1318. Both went stale a long time ago. The images can currently specify their location as Left, Center, or Right. However, they also need to specify their type - first page, even pages, or odd pages (which is what is used when neither of the others is applicable). This is accomplished by adding 18 new constants to `Worksheet\HeaderFooter`, any of which can be specified as the second argument to `HeaderFooter::addImage`. Somewhat surprisingly, no changes are required to Xlsx Writer or Reader.

Xls Reader and Writer support header/footer, but do not support using images in them. No other readers nor writers support header/footer.
2025-08-04 18:15:19 -07:00
oleibman 9a193f2841 Merge pull request #4571 from oleibman/calcformulatests
Clean Up Some Engineering Tests
2025-08-03 23:34:51 +00:00
oleibman 79fca7601c Clean Up Some Engineering Tests
This came to light while cleaning up ComplexAssert. Many tests are calling `_calculateFormulaValue` rather than `calculateFormula`, and, as a result, have to be trimmed before asserting. This PR changes those calls, and does a bit more to simplify the tests. There are a lot of other non-Engineering tests which call `_calculateFormulaValue`, but none of those need to manipulate the result after the test.

This PR changes only tests, no source code.
2025-08-03 13:48:45 -07:00
oleibman f65b0a2d10 Merge pull request #4570 from oleibman/complextests
Redo ComplexAssert
2025-08-03 15:56:42 +00:00
oleibman e78bca9668 Merge pull request #4556 from oleibman/xmlspace
Xlsx Writer Eliminate xml:space From Non-Text Nodes
2025-08-03 15:46:51 +00:00
oleibman c32605828b Update CHANGELOG.md 2025-08-03 08:44:08 -07:00
oleibman 3dcdbcac3e Redo ComplexAssert
Its use is already causes an issue with Phpstan. It uses interfaces marked as internal by Phpunit, and it will not work with Phpunit 12. It is more complicated than needed. This PR corrects all these problems. It also corrects a handful of other problems that will show up with Phpunit 12. Only tests are changed - no source code.
2025-08-03 08:25:05 -07:00
oleibman 8f7a401f74 Merge pull request #4569 from oleibman/stanfixer
Upgrade Phpstan and php-cs-fixer
2025-08-03 04:07:14 +00:00
oleibman eb53b55157 Upgrade Phpstan and php-cs-fixer 2025-08-02 20:29:32 -07:00
oleibman b726eb3f1c Merge pull request #4554 from oleibman/deprecations
Eliminate Deprecated Constants
2025-08-03 02:10:41 +00:00
oleibman 6d8fc67512 Merge branch 'master' into deprecations 2025-08-02 19:07:45 -07:00
oleibman 7e89ad9e08 Merge pull request #4551 from oleibman/base2html
Minor Breaking Change - Move Some BaseWriter Properties
2025-08-03 01:49:48 +00:00
oleibman 20ac2f1940 Merge pull request #4527 from oleibman/issue4522
Minor Breaking Change to DefaultValueBinder
2025-08-03 01:48:03 +00:00
oleibman ac4befd2f7 Merge commit from fork 2025-08-02 18:06:29 -07:00
oleibman 150b3849a8 Create Uninitialized Cell If Used in Calculation
Fix #4558. Fix #4530. 4558 deals with a problem with COUNTA. Excel does not count empty cells, but it does count literal nulls (usually empty parameters) in the argument list. PhpSpreadsheet has till now not created empty cells during calculation, and so winds up treating them as literals. It is changed to create the cell when appropriate.

4530 has a similar problem. When INDIRECT winds up evaluating an uninitialized cell, it treats it as a null literal, leading to incorrect results. It is now changed to create the missing cell.

A number of functions, almost all of them Financial, have a related problem. They test for a null literal when initializing some of their parameters, but they should be testing for null literal or cell containing null. They are changed to do the right thing.

SUMIF and related functions are slightly affected by this change, and are changed so that they are no longer affected.

New tests have been added. Only one existing test had to change. MergeBehaviorTest for `[12, '=5+1', '=A1/A2']`, where cell A2 was uninitialized formerly returned one row, but now returns a second all-null row because A2, by virtue of being used in a calculation, now winds up defined. I do not consider this a significant difference.
2025-07-31 23:58:05 -07:00
oleibman 079dc87604 More Tweaks 2025-07-30 23:27:08 -07:00
oleibman 624dafa3b8 Merge branch 'master' into deprecations 2025-07-30 21:33:35 -07:00