Commit Graph

4666 Commits

Author SHA1 Message Date
oleibman ef2b5b9e00 Mostly Docs and Tests
Also support for Xml format.
2024-06-21 21:55:05 -07:00
oleibman 3a690a755c SINGLE Function, and Gnumeric
SINGLE function can be used to return first value from a dynamic array result, or to return the value of the cell which matches the current row (VALUE error if not match) for a range. Excel allows you to specify an at-sign unary operator rather than SINGLE function; this PR does not permit that.

Add support for reading CSE array functions for Gnumeric.

Throw an exception if setValueExplicit Formula is invalid (not a string, or doesn't begin with equal sign. This is equivalent to what happens when setValueExplicit Numeric specifies a non-numeric value.

Added a number of tests from PR #2787.
2024-06-21 07:08:22 -07:00
oleibman 0b471ef772 Dead Code, and 1 Static Call to Non-Static 2024-06-20 01:21:43 -07:00
oleibman 2c9e2e2b43 Spill Operator
Spill operator now works both as trailing `#` and ARRAYANCHOR function. `#` is converted to ARRAYANCHOR when writing. I do not think it is important to convert the other way when reading.

Documentation updates have started, but are a work in progress.

SINGLE function is implemented. I believe it works correctly when referring to a cell, but not when referring to a cell range. No attempt is yet made to convert leading `@` to and from SINGLE; I haven't figured out how to do so without interfering with `@` in structured references.

ISREF has problems. At least one of its tests was wrong, and many of those that were right were so accidentally. The code is changed, quite kludgily, so that almost all the tests are now deliberately correct. One very complicated test is incorrect; for now, I will skip it, and will open an issue when this PR is merged.
2024-06-20 00:43:03 -07:00
oleibman 8609b78e53 Eliminate Dead Code 2024-06-17 15:19:55 -07:00
oleibman d7700125fa Spills
Implement SPILL for dynamic arrays. Calculating a dynamic array function will result in a SPILL error if it attempts to overlay a non-null cell which was not part of its previous calculation. Furthermore, it will set to null all cells which were part of its previous calculation but which are not part of the current one (i.e. one or both of the dimensions of the calculation is smaller than it had been); this should also apply for spills (whose result is reduced to 1*1).

Excel will stop you from changing the value in any cell in a dynamic array except the formula cell itself. I have not built this particular aspect into PhpSpreadsheet.

As usual, MS has taken some unusual steps here. If the result of a dynamic array calculation is #SPILL!, it will nevertheless be written to the xml as #VALUE!. It recognizes this situation by adding a new `vm` attribute to the cell, and expanding metadata.xml to recognize this.

A new optional parameter `$reduceArrays` is added to `toArray` and related functions. This will reduce a dynamic array to its first cell, which seems more useful than outputing it as an array (default).
2024-06-17 14:22:52 -07:00
oleibman 784e8a0288 Drop Some Dead Code 2024-06-14 09:26:08 -07:00
oleibman ad2194d737 CONCATENATE Changes, and Csv/Html/Ods Support
The CONCATENATE function has been treated as equivalent to CONCAT. This is not how it is treated in Excel; it is closer to (and probably identical to) the ampersand concatenate operator. The difference manifests itself when any of the arguments is an array (typically a cell range). Code is added to support this difference.

Support for array results is added to Csv Writer, Html Writer, and Ods Reader and Writer. I have not figured out how to get it to work with Xls.
2024-06-14 08:30:18 -07:00
oleibman 846fec7afa Minor Performance Improvements 2024-06-10 09:19:35 -07:00
oleibman ef176f382e Excel Handle Array Functions as Dynamic Rather than CSE
With a number of changes, PhpSpreadsheet can finally generate a spreadsheet which Excel will recognize as a Dynamic Array function rather than CSE. In particular, changes are needed to ContentTypes, workbook.xml.rels, cell definitions in the worksheet, and a new metadata.xml is added.
2024-06-09 20:48:32 -07:00
oleibman 3daac0a640 Add TODO Note
ArrayFunctions2Test - the calculations seem too complicated for PhpSpreadsheet. The debug log is 21,300 lines, so I don't know how far I will get with it.
2024-06-06 13:16:16 -07:00
oleibman 6b5bf84fbb Still More Formatting
I think I should go back to bed.
2024-06-06 07:09:50 -07:00
oleibman 47481c6a12 More Formatting
Frustrating morning.
2024-06-06 07:05:19 -07:00
oleibman 1b2198419e Incorrect Case for Filename 2024-06-06 07:01:45 -07:00
oleibman 856a00b8f0 Formatting 2024-06-06 06:55:33 -07:00
oleibman 08ba00b575 Populate Rest of Array Cells, UNIQUE Changes
See issue #4062. When calculating an array formula, populate all the cells associated with the result. This is almost the same as Excel's behavior. As yet, there is no attempt to create a #SPILL error, so cells may be inappropriately overwritten. Also, if the array size shrinks (e.g. there are fewer unique values than before),  no attempt is made to unpopulate the cells which were in range but are now outside the new dimensions. Spill and unpopulation are somewhat related, and will probably be handled at the same time, but their time has not yet come.

UNIQUE, at least for rows, was treating all cell (calculated) values as strings. This is not the same behavior as Excel, which will preserve datatypes, and treat int 3 and string 3 as unique values. Excel will, however, treat int 3 and float 3.0 as non-unique. Within UNIQUE, private function uniqueByRow is changed to try to preserve the the datatype when executing (it will probably treat 3.0 as int - I don't know how I can, or even if I should attempt to, do better - but no int nor float should be treated as a string).
2024-06-06 06:52:14 -07:00
oleibman b79cd20f75 Merge branch 'master' into atsign 2024-06-05 06:58:26 -07:00
oleibman fc74f00795 Merge pull request #4059 from oleibman/run83
Run Tools Using Php8.3
2024-06-04 13:37:15 +00:00
oleibman 133e4fdab9 Scrutinizer Failed Building Php8.3 - Try 8.2 2024-06-03 08:04:46 -07:00
oleibman 68713ecabb Run Tools Using Php8.3
Php8.1 is approaching EOL. Change our tools to run under 8.3 instead. I do not anticipate any difficulty for phpstan, php-cs-fixer, phpcs, phpdoc-types, versions, or coverage. PhpDocumetor needs to run with an updated phar, and I'm not sure whether it will be run until a release happens. No idea how Scrutinizer will handle the change; I'll just have to try it and see.
2024-06-03 07:42:28 -07:00
oleibman 5e7ebf3d91 Merge branch 'master' into atsign 2024-06-03 06:32:43 -07:00
oleibman 318a82e0f9 Merge pull request #4057 from oleibman/unitstan
Phpunit 10 and Phpstan 1.11
2024-06-03 13:28:08 +00:00
oleibman 192d4a3dd5 Resolve Phpstan missingType.generics
Doc-block changes only; no change to executable code.
2024-06-02 14:40:07 -07:00
oleibman 6be8be8c1b Update Phpunit Command in main.yml 2024-06-01 17:50:22 -07:00
oleibman 9b239ebdb0 Phpunit 10 and Phpstan 1.11
Dependabot suggested some changes this month which required an unusual effort to implement successfully. With the elimination of Php 8.0 as a supported environment, it became possible to use Phpunit 10 rather than 9. Among other considerations, the configuration file for Phpunit is changed. I preserved the Phpunit 9 version under a different name. Aside from the configuration change, several other changes needed to be made to accommodate the change:
- Fix #3993. A peculiar problem indeed. One of the reporters said it had something to do with mocking, but I couldn't duplicate it. But Phpunit 10 revealed the problem in one test (Reader/Xlsx/AutoFilterTest), and that was sufficient for me to apply the trivial source code change to Worksheet/Worksheet.
- Some extra stringency on data providers required extra work in Calculation/CalculationFunctionListTest.
- There was a misplaced label in Calculation/ParseFormulaTest. Likewise in the data member CellGetRangeBoundaries.
- More stringency required changes to data members Shared/Trend/ExponentialBestFit and Shared/Trend/LinearBestFit.
- Issue3982Test testLoadAllRows seemed to go into a memory-acquiring loop in 10 that was not evident in 9. This particular test uses a lot of memory by design, but was included only to establish a base level for the other tests in that member. I feel it is acceptable to skip it for 10.

Phpstan errors with a new release are not unusual. One of the problems this time around was, however, unusual - it is fixed when Phpstan runs under Php8.3, but not for earlier Php releases. Our tools currently use Php 8.1. It is on my to-do list to get Phpstan and other test tools running under 8.3 before 8.1 goes EOL. There are also some configuration file changes needed for Phpstan.

Php-cs-fixer has been taking an increasingly long time to run. They've added an experimental option to permit it to run its checks in parallel. I've changed its configuration to use that option.
2024-06-01 17:39:39 -07:00
oleibman 101f90310f Merge pull request #4054 from PHPOffice/dependabot/composer/dompdf/dompdf-3.0.0
Bump dompdf/dompdf from 2.0.8 to 3.0.0
2024-06-01 13:29:14 +00:00
oleibman 5c8f95cdd4 Merge pull request #4052 from PHPOffice/dependabot/composer/squizlabs/php_codesniffer-3.10.1
Bump squizlabs/php_codesniffer from 3.9.2 to 3.10.1
2024-06-01 13:28:37 +00:00
oleibman 8a22155e09 Merge pull request #4051 from PHPOffice/dependabot/composer/friendsofphp/php-cs-fixer-3.58.1
Bump friendsofphp/php-cs-fixer from 3.56.1 to 3.58.1
2024-06-01 13:28:22 +00:00
dependabot[bot] caa148ade8 Bump dompdf/dompdf from 2.0.8 to 3.0.0
Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 2.0.8 to 3.0.0.
- [Release notes](https://github.com/dompdf/dompdf/releases)
- [Commits](https://github.com/dompdf/dompdf/compare/v2.0.8...v3.0.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-01 11:10:05 +00:00
dependabot[bot] 5db40920cc Bump squizlabs/php_codesniffer from 3.9.2 to 3.10.1
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.9.2 to 3.10.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.2...3.10.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-01 11:09:56 +00:00
dependabot[bot] 2914239d9c Bump friendsofphp/php-cs-fixer from 3.56.1 to 3.58.1
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.56.1 to 3.58.1.
- [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.56.1...v3.58.1)

---
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-06-01 11:09:52 +00:00
oleibman 3360608cdd Merge pull request #4042 from oleibman/issue4039
Conditional Range Unions and Intersections
2024-06-01 01:07:59 +00:00
oleibman a6000b63e5 Update CHANGELOG.md 2024-05-31 18:04:55 -07:00
oleibman 1852923c62 Merge pull request #4050 from oleibman/issue4049
Conditional Color Scale Improvements
2024-05-31 15:53:34 +00:00
oleibman 15fb1b542a Merge branch 'master' into issue4049 2024-05-31 08:50:17 -07:00
oleibman 24e6f4d837 Update CHANGELOG.md 2024-05-31 08:48:34 -07:00
oleibman c78888cf90 Merge branch 'master' into atsign 2024-05-30 21:31:37 -07:00
oleibman 626b08fcd3 Merge pull request #4026 from oleibman/stan9c
Better Definitions for Mixed Parameters and Values Part 2 of Many
2024-05-31 04:04:05 +00:00
oleibman d539dfa2d5 Merge pull request #4047 from oleibman/issue3557
Writer Mpdf and Tcpdf Borders on Merged Cells
2024-05-30 17:14:48 +00:00
oleibman 60d49eca1c Merge branch 'master' into issue3557 2024-05-30 10:11:18 -07:00
oleibman 52743f9e1b Update CHANGELOG.md 2024-05-30 10:08:51 -07:00
oleibman fcc5cf1369 Minor Test Improvement 2024-05-30 09:35:40 -07:00
oleibman 2760e5abb7 Conditional Color Scale Improvements
Fix #4049. Some possible options were not included for read or write. In addition, although it isn't well documented, it appears that 2-color scale always has 2 cvfo entries in Xml in order minimum/maximum, and 3-color scale always has 3 entries in order minimum/midpoint/maximum.
2024-05-30 00:19:11 -07:00
oleibman 0b4bdfb510 Add Disconnects to Tests 2024-05-29 19:23:33 -07:00
oleibman cf6c8046eb Full(?) Conditional Range Union and Intersection Support
Provide a means to convert a range, possibly with unions and possibly with intersections, into something that both Excel and PhpSpreadsheet can handle. Intersections are changed into unions of the individual cells which they comprise. With this change, Xls Writer now handles intersections (previously it would have thrown an Exception or created a corrupt worksheet if this was attempted), and Xlsx Writer works correctly (it seemed to before, but Excel didn't understand what it wrote). Worksheet::getConditionalRange and ::getConditionalStyles would previously have thrown an Exception when presented with an intersection, and will no longer do so.

**NOTE:** Intersection support is limited to Conditional ranges. Use of intersections in other contexts will usually not achieve the desired result.
2024-05-29 08:19:17 -07:00
oleibman c65674cbcb Merge branch 'master' into issue4039 2024-05-28 17:17:54 -07:00
oleibman c8f5c62e5d Invert Union and Intersection Between Excel and Xml
I don't know why MS did this. We're stuck with it.
2024-05-28 17:01:45 -07:00
oleibman 4be300865c Writer Mpdf and Tcpdf Borders on Merged Cells
Fix #3557. Borders around merged cells are not handled correctly for Mpdf. Although a perfectly acceptable workaround is suggested in the issue, it would be better if things just worked without the workaround. Html and Dompdf work with the existing code. As it turns out, Tcpdf does not work, but for a different reason than Mpdf.

Mpdf was not working because Mpdf does not honor the `!important` attribute in Css. We can get it working almost perfectly by suppressing `border*:none`; the exception is fairly Byzantine, and I'll be glad to discuss the matter should anyone report a problem with it. At any rate, it's not working now in the exception case, so we won't be any worse off.

Tcpdf was not working because the merging of attributes happened only when `useInlineCss` was not being used, but Tcpdf does use it. Merging of border attributes is now added for useInlineCss.
2024-05-27 16:38:04 -07:00
oleibman 68218c175d Merge pull request #4033 from oleibman/condxlsborder
Xls Conditional Border
2024-05-26 01:53:12 +00:00
oleibman d0c49cd666 Merge branch 'master' into condxlsborder 2024-05-25 18:46:13 -07:00