Commit Graph

3090 Commits

Author SHA1 Message Date
oleibman 9893926ff9
Add Test For NULL=0 (#2607)
Fix #2523. This isn't actually a fix; the problem was reported and confirmed for 1.21, but had already been fixed in master (and remains fixed in 1.22). This PR just adds a unit test for the original problem.
2022-02-19 13:12:44 -08:00
Mark Baker 71927f5591
Issue 2551 array enable lookup ref functions (#2606)
* Start work on array-enabling the Lookup and Reference functions

Requires a new method (`evaluateArrayArgumentsSubsetFrom()`) in the `ArrayEnabled` Trait to handle functions where the arguments that need special array handling are trailing rather than leading arguments
2022-02-19 18:49:01 +01:00
Mark Baker c10d86eb9c
Start work on array-enabling the Lookup and Reference functions (#2602)
* Start work on array-enabling the Lookup and Reference functions

Requires a new method (`evaluateArrayArgumentsSubsetFrom()`) in the `ArrayEnabled` Trait to handle functions where the arguments that need special array handling are trailing rather than leading arguments
2022-02-19 18:36:50 +01:00
Mark Baker d5dc58d20e
Extract information functions (#2605)
* Split Information functions into a dedicated class and namespace and categorise as Value or Error
* Refactor all error functions into the new ExcelError class
2022-02-19 13:53:17 +01:00
Mark Baker 9c473682bc
Set precision for Database function unit tests, for RowColumnReference and Dimension Helper unit tests (#2604) 2022-02-18 21:37:26 +01:00
Adrien Crivelli 3c0004760d
Prepare changelog for next version 2022-02-18 14:01:46 +01:00
Adrien Crivelli 3a9e29b4f3
1.22.0 2022-02-18 13:57:07 +01:00
Adrien Crivelli f4885d90dc
PHP 8.1 compatibility 2022-02-18 13:14:35 +01:00
Mark Baker 0371ccb686
Convert all relevant Logical functions to support array arguments (#2600) 2022-02-18 02:56:23 +01:00
Mark Baker e580f10c46
Unit test some basic arra-formula chaining (#2599) 2022-02-17 19:37:40 +01:00
Mark Baker 03993bce05
The last big block of Engineering functions; those involving complex numbers (#2597) 2022-02-17 15:17:33 +01:00
Roland Eigelsreiter 1a4e4ed7c5 fix php 8.1 error when autoFilter['ref'] is null 2022-02-17 14:43:18 +01:00
Mark Baker ef839f56be
Get started with array-enabling the Engineering functions - Erf, Bessel, bitwise, comparisons Unit of Measure and Number base conversions first (#2594) 2022-02-16 18:32:07 +01:00
Mark Baker cdbe5c7c9b
Converting Statistical functions to be array-enabled (phase #2) (#2593) 2022-02-15 20:34:39 +01:00
Mark Baker f1cb75eaec
Start work on Array-enabling the Statistical functions (#2588) 2022-02-15 14:41:17 +01:00
Mark Baker 7901eb0b91
Eliminate calls to flattenSingleValue() that are no longer required in TextData Functions when we're checking for array values as arguments (#2592) 2022-02-15 01:29:12 +01:00
Mark Baker 70c12d2b05
Eliminate calls to flattenSingleValue() that are no longer required when we're checking for array values as arguments (#2591) 2022-02-14 23:11:53 +01:00
Mark Baker 7e996a7c98
Eliminate calls to flattenSingleValue() that are no longer required when we're checking for array values as arguments (#2590) 2022-02-14 22:59:39 +01:00
Aaron Layson aff97833c6
Renamed "worskeet" to "worksheet" comment typo (#2589) 2022-02-14 08:07:04 -08:00
Mark Baker e3b7cb5f9d
I'm ignoring SUMIF() and SUMIFS() for the moment; so this should complete all the applicable Math/Trig functions;so the subset SERIESSUM() function and RANDBETWEEN() should complete Math/Trig (#2586) 2022-02-13 12:50:05 +01:00
oleibman c9d1df8554
Update Changelog (#2587)
Catch up with some earlier changes.
2022-02-13 00:45:27 -08:00
Mark Baker de2fb1f438
Reset phpstan to level 8... there's too many issues working with mixed and needing to cast to a specific type like string; but the alternative for maintaining exact types is a unnecessar extra of code for explicit handling of casting with checks that we don't need when we know datatypes from manual viewing of the codebase (#2585) 2022-02-12 22:04:02 +01:00
Mark Baker 8f3c52a3cf
Enable array-readiness for more Math/Trig functions (#2584)
* Enable array-readiness for more Math/Trig functions; CEILING() FLOOR() (and variants), TRUNC(), BASE() and the various Logarithms
* Minor refactoring
2022-02-12 20:47:47 +01:00
Mark Baker 866dd38611
Merge pull request #2583 from PHPOffice/Issue-2551_Enable-Array-Readiness-for-Functions-Maths
Issue 2551 - Enable array-readiness for more Math/Trig functions
2022-02-12 17:21:57 +01:00
Mark Baker 5d88c6b534
Merge branch 'master' into Issue-2551_Enable-Array-Readiness-for-Functions-Maths 2022-02-12 17:11:45 +01:00
MarkBaker 75213f5ee1 Enable array-readiness for more Math/Trig functions 2022-02-12 16:56:06 +01:00
Orkhan Ahmadov 0eeba6dc0c
`ReferenceHelper@insertNewBefore` checks for missing coordinates before replacing values (#2541)
* ReferenceHelper@insertNewBefore now changes for missing columns before replacing and deleting columns

* Changelog updated

* Fixed code style

* Added assertion for all cells. Change bugfix implementation to use `createNewCell` on Worksheet

* Additional assertions
2022-02-12 07:08:11 -08:00
mweimerskirch 90e9ea9505
Fixed handling of inline strings in XLSX (#2569)
* Fixed handling of inline strings

* Added an example for the "inline string" datatype for which the generated XML was fixed in the previous commit.

* Handle inline strings exactly the same way as regular strings in the XLS writer, because this is only relevant in the XLSX format.
2022-02-12 06:55:48 -08:00
oleibman 5bf0656e92
Xlsx Reader Warning When No sz Tag for RichText (#2550)
Fix #2542. Xlsx Reader is expecting a `sz` tag when reading RichText, but it is not required, and PhpSpreadsheet issues a warning message when it is missing.
2022-02-12 06:43:29 -08:00
Mark Baker b300e186fe
Merge pull request #2582 from PHPOffice/Issue-2551_Array-ready-Functions-Text-Phase-2
Issue 2551 - Array-ready Functions - Text Phase 2
2022-02-12 12:41:59 +01:00
MarkBaker b3ff2e347f All Text functions made array-ready 2022-02-12 12:22:31 +01:00
Mark Baker 6a2905a34c
Merge pull request #2580 from PHPOffice/Issue-2551-Array-Ready-Function-Financial
Issue 2551 - array ready functions - Text (phase #1)
2022-02-11 19:19:03 +01:00
Mark Baker d2473441c3
Merge branch 'master' into Issue-2551-Array-Ready-Function-Financial 2022-02-11 19:07:33 +01:00
MarkBaker c41dd0afae FIND(), SEARCH(), LEFT(), RIGHT, MID(), CLEAN(), TRIM(), TEXTJOIN() and REPT() functions 2022-02-11 18:56:21 +01:00
oleibman ad5532e2f4
Namespacing Phase 2 - Styles (#2471)
* WIP Namespacing Phase 2 - Styles

This is part 2 of a several-phase process to permit PhpSpreadsheet to handle input Xlsx files which use unexpected namespacing. The first phase, introduced as part of release 1.19.0, essentially handled the reading of data. This phase handles the reading of styles. More phases are planned.

It is my intention to leave this in draft status for at least a month. This will give time for additional testing, by me and, I hope, others who might be interested.

This fixes the same problem addressed by PR #2458, if it reaches mergeable status before I am ready to take this out of draft status. I do not anticipate any difficult merge conflicts if the other change is merged first.

This change is more difficult than I'd hoped. I can't get xpath to work properly with the namespaced style file, even though I don't have difficulties with others. Normally we expect:
```xml
<stylesheet xmlns="http://whatever" ...
```
In the namespaced files, we typically see:
```xml
<x:stylesheet xmlns:x="http://whatever" ...
```

Simplexml_load_file specifying a namespace handles the two situations the same, as expected. But, for some reason that I cannot figure out, there are significant differences when xpath processes the result. However, I can manipulate the xml if necessary; I'm not proud of doing that, and will gladly accept any suggestions. In the meantime, it seems to work.

My major non-standard unit test file had disabled any style-related tests when phase 1 was installed. These are now all enabled.

* Scrutinizer

Its analysis is wrong, but the "errors" it pointed out are easy to fix.

* Eliminate XML Source Manipulation

Original solution required XML manipulation to overcome what appears to be an xpath problem. This version replaces xpath with iteration, eliminating the need to manipulate the XML.

* Handle Some Edge Cases

For example, Style file without a Fills section.

* Restore RGB/ARGB Interchangeability

Fix #2494. Apparently EPPlus outputs fill colors as `<fgColor rgb="BFBFBF">` while most output fill colors as `<fgColor rgb="FFBFBFBF">`. EPPlus actually makes more sense. Regardless, validating length of rgb/argb is a recent development for PhpSpreadsheet, under the assumption that an incorrect length is a user error. This development invalidates that assumption, so restore the previous behavior.

In addition, a comment in Colors.php says that the supplied color is "the ARGB value for the colour, or named colour". However, although named colors are accepted, nothing sensible is done with them - they are passed unchanged to the ARGB value, where Excel treats them as black. The routine should either reject the named color, or convert it to the appropriate ARGB value. This change implements the latter.
2022-02-11 06:42:04 -08:00
MarkBaker c9886127c0 Style and phpstan cleanups 2022-02-11 13:55:52 +01:00
MarkBaker 8818a7d620 Merge branch 'master' into Issue-2551-Array-Ready-Function-Financial
# Conflicts:
#	phpstan-baseline.neon
#	src/PhpSpreadsheet/Calculation/Financial/Dollar.php
2022-02-11 13:36:35 +01:00
Mark Baker 88da4e17e5
Merge pull request #2579 from PHPOffice/Issue-2578_Negative-dollar-values-for-DOLLARDE()-and-DOLLARFR()-Functions
Fix for DOLLARDE() and DOLLARFR() with negative dollar values
2022-02-11 13:30:43 +01:00
MarkBaker f577dde178 Fix for DOLLARDE() and DOLLARFR() with negative dollar values
Additional argument validations
2022-02-11 13:19:44 +01:00
MarkBaker df12b06c59 Text function array value tests, plus some cleanup 2022-02-11 12:34:29 +01:00
Mark Baker 5ab3cbc8db
Merge pull request #2573 from PHPOffice/Issue-2551_Array-Enabled-DateTime-Functions
Enable most of the Date/Time functions to accept array arguments
2022-02-10 21:32:58 +01:00
MarkBaker dfc19dba58 Regenerate phpstan baseline 2022-02-10 21:08:53 +01:00
MarkBaker b741193184 Refactoring of the processor 2022-02-10 20:53:58 +01:00
MarkBaker 1e59b9113f Last of the work on array-enabling Date/Time functions; all completed in this category 2022-02-10 20:53:58 +01:00
MarkBaker ca81991728 phpcs cleanup 2022-02-10 15:40:30 +01:00
MarkBaker ec2ca1764f The `WORKDAY()` function accepts 2 "static" arguments that could be passed as arrays; but also accepts a set of trailing date arguments that are accepted as an array by the splat operator. Only the first two arguments should be tested for returning array values; but the logic still needs to work with the full argument set.
Provide a separate "subset" method in the `ArrayEnabled` Trait, that allows a subset of arguments to be tested for array returns.

Set up basic tests for `WORKDAY()`
2022-02-10 15:37:45 +01:00
MarkBaker 782644684b Fix error in handling cell reference when operand is a 1-d array 2022-02-10 15:37:45 +01:00
MarkBaker 83ff74b97e Enable most of the Date/Time functions to accept array arguments 2022-02-10 15:37:45 +01:00
Mark Baker 291ea88a6c
Initial work enabling Excel function implementations for handling arrays as arguments when used in "array formulae". (#2562)
* Initial work enabling Excel function implementations for handling arrays as aguments when used in "array formulae".

So far:
 - handling for single argument functions
 - for functions where only one of the arguments is an array (a matrix or a row/column vector)
 - for when there are two array arguments, and one is a row vector, the other a column vector
 - for when there are either 2 row vectors, or 2 column vectors
 - for a matrix and either a row or column vector 

Will work ok, as long as there are no more than two array arguments; still need to identify the logic to apply when there are more than two arrays; or there are two that aren't an already supported row vector/column vector pairing (ie two matrices).

* Throw an exception if we have three or more array arguments (after flattening) passed to a supported function until we can identify the abstruse non-euclidian logic behind how Excel handles building, using and presenting those n-dimensional result arrays

* Implement array arguments for the DATE() function so that we can verify that paired arrays/vectors work with functions that support more than 2 arguments

* Implement array arguments for the many of the Math/Trig functions

* Update change log
2022-02-09 15:12:54 +01:00
Sebastian Nohn 0ff0187f1f
fix most recent changes to the changelog: (#2561)
- fix indentation
- add links to PRs
- put latest changes to the bottom of each section
2022-02-07 09:17:29 -08:00