Commit Graph

5734 Commits

Author SHA1 Message Date
oleibman 3dfd3afff8 One More Test 2025-09-01 01:03:23 -07:00
oleibman f375d9a69b Minor Improvements to Calculation Coverage 2025-09-01 00:28:46 -07:00
oleibman b79b77cf0f Merge pull request #4611 from oleibman/strinc2
String Increments and Php8.5
2025-08-28 01:25:25 +00:00
oleibman f8f78a7ed3 String Increments and Php8.5
Fix #4600. String incrementation through the `++` operator is deprecated in Php 8.5. Because we make use of that operator to iterate through columns, we are particularly hard hit by that change - unaddressed, it causes over 2,000 errors in our test suite! It is, fortunately, not as difficult as I feared to correct. Replacing the `++` operator with a call to new method `StringHelper::stringIncrement` in 79 statements scattered over 31 source modules (in src, samples, test, and infra) eliminates all the messages in the test suite. It is possible that others are lurking, but I don't know a systematic way of determining if there are others. We'll stick with this for now, and deal with any others as they show up.

This PR will be applied to the master, release390, and release222 branches. It will not be applied to the release210 or release1291 branches, which will now accept security changes only.
2025-08-27 18:18:40 -07:00
oleibman 0a63194f86 Merge pull request #4608 from h-marumoto/fix_typo_in_reading-and-writing-to-file.md
Fix typo in reading-and-writing-to-file.md
2025-08-27 07:22:23 +00:00
h-marumoto 965361b75b Fix typo in reading-and-writing-to-file.md 2025-08-27 15:16:55 +09:00
oleibman b99dc608a0 Merge pull request #4598 from oleibman/issue2912
Better Handling of Print Area After Column/Row Removal
2025-08-26 16:15:58 +00:00
oleibman 87a78e13c5 Update CHANGELOG.md 2025-08-26 09:13:12 -07:00
oleibman ad76caed2d Merge pull request #4581 from oleibman/maxwidth
Maximum Column Width
2025-08-26 16:08:04 +00:00
oleibman c5aa1c8730 Merge branch 'master' into issue2912 2025-08-26 08:28:37 -07:00
oleibman 31502b05d5 Merge branch 'master' into maxwidth 2025-08-26 07:36:50 -07:00
oleibman 3c28bf4552 Merge pull request #4599 from oleibman/coverage
WIP Remove Scrutinizer, Add Coveralls
2025-08-26 14:32:39 +00:00
oleibman d8391bad15 Merge pull request #4601 from oleibman/strinc1
String Incremented Deprecated in 8.5 - First of Many
2025-08-26 01:06:31 +00:00
oleibman b3c81d3b8f String Incremented Deprecated in 8.5 - First of Many 2025-08-25 17:54:30 -07:00
oleibman 8f3477b673 WIP Remove Scrutinizer, Add Coveralls
Scrutinizer has been a source of problems for a long time. False positives, unavailability, not open source, irrelevant complexity flags.

I am a bit concerned because Scrutinizer sometimes seems to run even without a yaml file. We shall see.

I do still want coverage reports. Instead of uploading them to Scrutinizer, I will try Coveralls, which is used by PhpWord.
2025-08-24 19:34:29 -07:00
oleibman 8d3a9598c1 Support Multiple Ranges After All 2025-08-24 10:33:15 -07:00
oleibman 5e02e282c7 Better Handling of Print Area After Column/Row Removal
Fix #2912, another oldie (3+ years). Removal of rows or columns which include part of the print area is not recalculating the print area correctly. This PR will correct that problem, but only if the print area consists of a single range. I think that is by far the most common use case. If there is a demonstrated need to handle multiple ranges, I will respond to a new issue.
2025-08-24 09:05:12 -07:00
oleibman 63d3960f3b Merge pull request #4591 from oleibman/mpdf826
Update Mpdf (Php8.5 compatibility)
2025-08-21 18:30:51 +00:00
oleibman e949acc255 Update Mpdf (Php8.5 compatibility) 2025-08-21 11:21:40 -07:00
oleibman 2933bfd8e7 Merge pull request #4585 from oleibman/promise
Update react/promise (for Php8.5)
2025-08-19 23:40:15 +00:00
oleibman 49ebe5c460 Update react/promise (for Php8.5) 2025-08-19 16:31:21 -07:00
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 06fef872be Maximum Column Width
PR #455 was submitted by @Aketos in 2018. It added no unit tests, so it was not merged, and it eventually went stale. Without the tests, I'm not sure exactly what the user had in mind. But my investigation indicates the following:
- for Xls files, if the column width in the file specifies a value greater than 255, Excel will choose its own width when it opens the file.
- for Xlsx files:
    - Excel does not allow you to set a column width > 255, neither by dragging the column boundary, nor by right-clicking and setting a value, nor by auto-fitting the column width.
    - Nevertheless, if the XML specifies a column width > 255, Excel will honor that value in the displayed spreadsheet, and even write it out if the file is saved.


I have taken a different approach than the original PR, which changed `Worksheet::calculateColumnWidths`. Instead, this PR adds an option to the Xlsx Writer to either restrict column widths to 255 or not. The default is "not" in order to avoid a breaking change. For emulating Excel's behavior, in the unusual situation where it might matter, the user might consider using the non-default option.

This PR also restricts column dimension width to 255 when saving an Xls file.
2025-08-17 20:29:47 -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