Commit Graph

3715 Commits

Author SHA1 Message Date
MarkBaker c704d4e990 Refactor the stack processor to identify Structured Reference tokens early, so that they can be converted to a cell address or cell range before continuing through the stack processor logic (although at this point, we're just throwing an Exception) 2022-11-22 18:08:04 +01:00
MarkBaker 0244fb4fc8 Store StructuredReference object in the stack rather than simply the Structured Reference string, so that we don't have to create the object for both lexer and parser 2022-11-22 13:31:35 +01:00
Mark Baker a16ce29e2a Merge branch 'master' into CalcEngine-Feature_Structured_References 2022-11-22 10:21:38 +01:00
oleibman 525384e573 Fix DocBlock in Style (#3200)
There is a DocBlock `@var ?array<string, array>` which causes PhpDocumentor to fail parsing Style/Style, so the online API documentation for that class is missing. Changing to `@var null|array<string, array>` fixes the problem.
2022-11-21 21:28:57 -08:00
oleibman 704a7b9fd1 Fix Unintential Deprecated Calls in Tests - LOOKUPREF (#3174)
* Fix Unintential Deprecated Calls in Tests - LOOKUPREF

I think it's best to install these before PR #3166. There are no changes to source code, only to test members which continue to inadvertently use calls to deprecated functions.

* Fix deprecation DocBlocks

Deprecated->deprecated, adjust see and comments

* One Intentional Deprecation

Annotate it.
2022-11-21 19:54:14 -08:00
oleibman 26e17277e1 Eliminate Some Scrutinizer 'Major' Problems Part 5 (#3161)
* Eliminate Some Scrutinizer 'Major' Problems Part 5

More of the same. 2 or 3 of these still to go after this.

Note one deprecation. Shared/Drawing has a method imagecreatefrombmp. However, that was introduced as a native PHP function with 7.2, so the method is no longer needed.

* More Silliness

Keep trying.

* If At First You Don't Succeed

Try, try again.
2022-11-21 15:31:13 -08:00
MarkBaker 8955859925 Update FAQ 2022-11-21 21:15:49 +01:00
Mark Baker b6f9ef17fe Merge pull request #3198 from PHPOffice/Github-CI_PHP-7.3-Issue
See if reintroducing PHP 7.3 in the matrix fixes the CI Workflow issue
2022-11-21 15:45:25 +01:00
MarkBaker 596a00bf69 This is going to be a real pain 2022-11-21 15:16:36 +01:00
MarkBaker 575a1efb2b Heaven only knows why the CI pipelines are complaining about a PHP 7.3 issue; all references to PHP 7.3 should have been removed from the workflows
Re-introducing 7.3 now, just to try and ensure that all checks pass, so that the 7.3 weirdness won't be a blocker for merging
2022-11-21 15:11:30 +01:00
Mark Baker 8b9b32d647 Merge pull request #3197 from PHPOffice/BugFix_Default-arguments-for-TEXTJOIN
Support null and empty values in TEXTJOIN()
2022-11-21 15:02:45 +01:00
MarkBaker 9f6bbd71b6 BugFix - Support null values in TEXTJOIN() text values as well as empty strings
Allow default values for TEXTJOIN() delimiter and ignore_empty... even though the official MS documentation lists them as required arguments, they are actually optional
2022-11-21 14:35:42 +01:00
Mark Baker f1be181858 Merge pull request #3194 from PHPOffice/ConditionalFormatting_Eliminate-duplicate-setter-code
Eliminate duplicate call to set Conditional Styles in the model when loading an Xls file
2022-11-20 21:59:59 +01:00
Mark Baker db1988e976 Merge branch 'master' into ConditionalFormatting_Eliminate-duplicate-setter-code 2022-11-20 21:47:18 +01:00
Mark Baker 1429999f0b Merge pull request #3193 from PHPOffice/Issue-2871_Merge-Cells-Bugfix-and-Performance
Eliminate call to getFormattedValue() when not required
2022-11-20 21:46:55 +01:00
MarkBaker bc3903a751 Eliminate call to getFormattedValue() when not required 2022-11-20 10:04:49 +01:00
MarkBaker 2e356821b3 Eliminate duplicate call to set Conditional Styles in the model when loading an Xls file 2022-11-18 10:41:22 +01:00
Adrien Crivelli 8f40b9841a Update GitHub Actions 2022-11-17 14:35:42 +01:00
Mark Baker 26cb1c1bcf Merge pull request #3163 from fox34/chart-write-y-axis-line-styles
Chart: Correctly handle axis line styles
2022-11-17 10:46:38 +01:00
MarkBaker 3e81da48f7 Initial parsing for Structured References 2022-11-15 20:00:36 +01:00
fox34 95d929441c Test different colors for different axis 2022-11-15 11:35:07 +01:00
fox34 8714b2e728 Also verify x-axis line color 2022-11-14 17:14:17 +01:00
fox34 4e6ac96e07 Remove unused imports 2022-11-14 16:51:41 +01:00
fox34 97c1a421ff Removing whitespace at end of line 2022-11-14 16:45:05 +01:00
fox34 d9d2484341 Formatting: Indent empty lines 2022-11-14 16:41:49 +01:00
fox34 18714e3ba2 Read axis line styles correctly 2022-11-14 16:39:34 +01:00
fox34 894b78eb2f Merge branch 'master' into chart-write-y-axis-line-styles 2022-11-14 16:05:21 +01:00
fox34 c2cdc36bb3 Create PR3163Test.php 2022-11-14 16:04:13 +01:00
MarkBaker 813da386df Set constants for recognising Structured References 2022-11-14 14:58:09 +01:00
fox34 e6d5616e2b Include PR in Changelog 2022-11-12 10:05:42 +01:00
Mark Baker c928bfd048 Merge pull request #3164 from PHPOffice/CalcEngine-Refactor_Formatted-Numbers
Refactoring for checks on strings containing formatted numeric values
2022-11-11 17:19:05 +01:00
MarkBaker 6a50973a8b Update Change Log 2022-11-11 12:28:26 +01:00
MarkBaker d7a2315c8e Additional unit tests 2022-11-11 12:28:26 +01:00
MarkBaker f5beafd845 Refactoring for checks on strings containing formatted numeric values when used in mathematical operations in the Calculation Engine 2022-11-11 12:28:26 +01:00
fox34 f574456ff0 Update CHANGELOG.md 2022-11-10 13:37:01 +01:00
fox34 ff10c83e09 Write line styles for chart y-axis
Bugfix: Also write line styles for y-axis of charts
2022-11-10 13:34:51 +01:00
Mark Baker 6f71efcb58 Merge pull request #3156 from fdjohnston/master
Convert percentages stored as strings to numerics in formula calculations
2022-11-10 12:10:03 +01:00
Mark Baker 04fb3bb37a Merge branch 'master' into master 2022-11-10 10:55:29 +01:00
Mark Baker 8a06e1b846 Merge pull request #3160 from PHPOffice/Version_PHP74_Minimum
Drop support for PHP 7.3
2022-11-10 10:31:59 +01:00
MarkBaker 6f3f450101 Improve readability 2022-11-10 10:11:07 +01:00
MarkBaker 64a197ee42 Styling fixes 2022-11-10 09:45:01 +01:00
MarkBaker 2ee4542c75 Add PHP 8.2 to "must pass", and "nightly" to "allow fail" 2022-11-10 04:22:54 +01:00
MarkBaker 36c25b4427 Drop support for PHP 7.3 2022-11-09 22:55:31 +01:00
fjohnston@avatarasoftware.com bb845fae23 Further Simplification
As was pointed out, the entire `pow` piece, as well as extracting exponent and exponent sign, was not necessary as casting to `float` will correctly handle scientific notation in a string.
Also added case-insensitive flag to the regexp to handle upper and lower case `e`.
2022-11-09 14:57:28 -05:00
fjohnston@avatarasoftware.com 0b350b144b Slight optimization: Only use pow if exponent is greater than zero
Originally thought I was being clever by using zero in `pow` to get 1, however after thinking about it all day I think it's probably better to avoid the call to `pow` if the exponent is zero; one less function call that has to be made.

I didn't take the time to look into benchmarks of `pow` to the zero vs the ternary to multiply by 1, but my gut tells me this is likely slightly faster.
2022-11-09 14:27:16 -05:00
oleibman f3c181dffb Update Change Log 2022-11-08 (#3158)
Add several changes merged since last similar change 2022-10-20.
2022-11-08 23:28:44 -08:00
oleibman bbfaa0c336 Eliminate Some Scrutinizer 'Major' Problems Part 4 (#3154)
* Eliminate Some Scrutinizer 'Major' Problems Part 4

Mostly docblock changes and annotations. Some code changes. A few more of these to go still.

* Missed a Couple

Fix them now.
2022-11-08 18:04:48 -08:00
fjohnston@avatarasoftware.com ab7b3b10f9 Using Named Capture groups to handle edge cases
Implemented the suggested named capture groups (nice trick) in the regexp to pull out only the values we need to perform the calculation.  Making use of the null coalescing operator to keep things nice and clean.  Note that I did have to add the `PREG_UNMATCHED_AS_NULL` to `preg_match` to ensure PHP returned null (since null coalescing only works on null and not '') when a match wasn't found for a capture group.

Also extended the regular expression to handle scientific notation (both positive and negative, and positive and negative exponents) as well as a negative symbol before or after a leading percentage sign.
2022-11-08 12:32:15 -05:00
oleibman 8de218f575 Problems Formatting Very Small and Very Large Numbers (#3152)
* Problems Formatting Very Small and Very Large Numbers

Fix #3128 (author found a workaround but the problem remains). For some complex masks, when a cast of the cell value from float to string results in the use of scientific notation, the result of the formatting is unusable. I believe this PR solves the problem for numbers close to zero (Php cast from float to string uses scientific notation starting with 1E-5), and for a range of large numbers which are not handled correctly now.

However, I have not found a way to ensure that the results match Excel for very large numbers (1E18 or larger); this change at least ensures that the resulting string is an accurate rendition of the number (which is not the case now) even if doesn't match Excel. As an example, if you use the mask reported in the original issue `0 000.0` and enter a value of 1E90 into the cell, Excel will show it as 1 followed by 87 zeros, a space, 3 more zeros, decimal point and zero. I have not figured out how to get PhpSpreadsheet to do that; for now, it will just return the formatted value as 1 followed by 90 zeroes instead (I might have chosen to go with scientific notation instead). I will continue to think about those, but do not feel it is worth delaying the improvements in this ticket while I do so.

The affected section of code also truncated to the appropriate precision. It now rounds, as Excel does.

This seemed to be an area of code where problems might arise on 32-bit systems, and, indeed, I found something in the formatting code which had to be changed for 32-bit to work correctly. As long as I was doing that anyhow, I ran the full test suite, and found that Php8.1 had introduced some new stringencies which caused problems in a handful of places. All were found in Xls Reader, and all are corrected now.

* Remove Dead Assignment

Scrutinizer will be happy now.
2022-11-07 06:36:04 -08:00
Jokūbas e05e354e14 Fix ODS read filter on number-columns-repeated cell (#3149) 2022-11-06 09:43:50 -08:00