Commit Graph

3162 Commits

Author SHA1 Message Date
MarkBaker f64e2c2408 Prep-work for handling matrix arithmetic in the calc engine, with some basic unit tests 2022-02-27 22:19:12 +01:00
MarkBaker 55be3b4b5a Minor typehint fixes 2022-02-27 22:05:44 +01:00
MarkBaker cff8303f1b Re-merge from baseline 2022-02-27 14:15:49 +01:00
MarkBaker 4d0f426f4f Merge branch 'master' into CalculationEngine-Array-Formulae-Initial-Work 2022-02-27 13:51:46 +01:00
Mark Baker fe969f59cc Merge pull request #2627 from PHPOffice/Improve-Translation-Separator-Conflict
Resolve `translateSeparator()` method to handle separators cleanly
Some refactoring of the Ods Reader classes to eliminate code duplication
2022-02-27 13:48:45 +01:00
MarkBaker b31d42c52f Some Refactoring of the Ods Reader, moving all formula and address translation from Ods to Excel into a separate class to eliminate code duplication 2022-02-27 13:31:24 +01:00
MarkBaker 99f488efc6 Resolve translateSeparator() method to handle separators (row and column) for array functions as well as for function argument separators; and cleanly handle nesting levels
Note that this method is used when translating Excel functions between en and other locale languages, as well as when converting formulae between different spreadsheet formats (e.g. Ods to Excel)

Nor is this a perfect solution, as there may still be issues when function calls have array arguments that themselves contain function calls; but it's still better than the current logic
2022-02-27 13:01:09 +01:00
MarkBaker e1f278bb20 Unit tests for reading/writing array formulae from Ods 2022-02-27 12:45:48 +01:00
MarkBaker 9413f00497 Some Refactoring of the Ods Reader, moving all formula and address translation from Ods to Excel into a separate class to eliminate code duplication 2022-02-27 12:45:48 +01:00
MarkBaker 1574f483ac Resolve translateSeparator() method to handle separators (row and column) for array functions as well as for function argument separators; and cleanly handle nesting levels
Note that this method is used when translating Excel functions between en and other locale languages, as well as when converting formulae between different spreadsheet formats (e.g. Ods to Excel)

Nor is this a perfect solution, as there may still be issues when function calls have array arguments that themselves contain function calls; but it's still better than the current logic
2022-02-27 12:45:48 +01:00
MarkBaker 7dfa06f369 Merge branch 'master' into CalculationEngine-Array-Formulae-Initial-Work 2022-02-26 23:06:30 +01:00
Mark Baker e6047cfa9d Merge pull request #2626 from PHPOffice/Ods-Merge-Range-Tests
Unit tests for merge ranges for Ods Reader/Writer
2022-02-26 23:04:28 +01:00
MarkBaker 444d0fd77c Unit tests for merge ranges for Ods Reader/Writer 2022-02-26 22:51:15 +01:00
MarkBaker e30e7cbfd4 More unit tests 2022-02-26 22:14:21 +01:00
MarkBaker 5672bd8df1 Resolve issues introduced during resolution of merge conflicts from master
minor refactoring
2022-02-26 20:43:12 +01:00
MarkBaker 45a770a3fc Merge branch 'master' into CalculationEngine-Array-Formulae-Initial-Work
# Conflicts:
#	src/PhpSpreadsheet/Cell/Cell.php
#	src/PhpSpreadsheet/Reader/Gnumeric.php
#	tests/data/Cell/SetValueExplicit.php
2022-02-26 16:37:17 +01:00
Mark Baker d88e8f85ba Merge pull request #2625 from PHPOffice/Iso-Date-Datatype-Additional-Unit-Tests
Minor refactoring of ISO Date checking
2022-02-26 16:10:24 +01:00
MarkBaker 138638ad57 Ensure that selected worksheet is correctly set from Gnumeric Reader 2022-02-26 16:00:28 +01:00
MarkBaker 2af0b66f5f Read number formatting for Gnumeric... highlighted as not occurring when reading date values 2022-02-26 15:20:00 +01:00
MarkBaker fe901d13b4 Read number formatting for Gnumeric... highlighted as not occurring when reading date values 2022-02-26 15:08:12 +01:00
MarkBaker 52071e9f4a ODS Reader should also use the new Method for date values 2022-02-26 15:07:20 +01:00
MarkBaker ef4029df63 Refactor ISO data type validation from cell to shared date; add extra checks for invalid dates; and appropriate unit tests 2022-02-26 14:13:12 +01:00
MarkBaker dc718ddfd6 Rename xlfn functions for Ods 2022-02-26 12:10:46 +01:00
MarkBaker a83e3c6b2b Initial work on Gnumeric reader to support array formulae 2022-02-26 12:10:11 +01:00
MarkBaker 200713a9b7 Initial work on ODS reader to support array formulae 2022-02-25 21:17:18 +01:00
MarkBaker a67cffc7d2 minor tweaks 2022-02-24 23:51:00 +01:00
MarkBaker 38069812ca Allow recalc of all values for a spillage range 2022-02-24 22:36:37 +01:00
MarkBaker b929dd17b5 Ensure that the fromArray() and toArray() functions retain the current cell 2022-02-24 22:00:13 +01:00
MarkBaker 7d5dc726b7 Maintain reference for cells inside a spillage range to prevent their being updated; but allow update of the actual formula cell (adjusting spillage range sa required), and allow setting/update during file load.
Additional unit tests for setting/clearing spillage range for array formulae
Plus a bugfix when worksheet context lost on clearing a spillage range
2022-02-24 15:37:03 +01:00
oleibman 9cf526a920 Reading Xlsx With Supplied Palette (#2595)
Fix #2499, which see for details of an obscure problem affecting both PhpSpreadsheet and Excel. Add support for palette contained in workbook styles. This seems to be a very rare occurrence, so allow it only when the palette contains exactly 64 entries. If there are other possibilities, we'll presumably have a new workbook to guide us how to handle them. Also add some tests for specification of indexed color without palette, another rarity (no in-range examples amongst our current files). Also change one private static array, initialized once at run-time and never changed, to a constant.
2022-02-23 22:09:22 -08:00
Thorsten Ho 0cb60a5098 Fix XLSX broken vertical align font style (#2619)
* Fix XLSX broken vertical align font style

* Add fix information to changelog

* Fix phpcs issues
2022-02-23 20:23:59 -08:00
MarkBaker c3652f31bf Merge branch 'master' into CalculationEngine-Array-Formulae-Initial-Work 2022-02-23 21:32:39 +01:00
Mark Baker 579145eb3c Wrap actual file loading in protected methods, while just providing a stub load() method in the BaseReader abstract. This is to allow a wrapper in the file loader logic across all Readers, with a try/catch block that can be used to handle special loader settings. (#2620) 2022-02-23 21:31:57 +01:00
MarkBaker 568921ca71 Start work linking cells in spillage areas to the cell containing the spilled formula 2022-02-23 17:28:40 +01:00
MarkBaker 76fbf38232 Merge branch 'master' into CalculationEngine-Array-Formulae-Initial-Work
# Conflicts:
#	tests/PhpSpreadsheetTests/Calculation/Functions/MathTrig/AbsTest.php
2022-02-22 22:40:44 +01:00
Mark Baker 16953e27d8 Adjust Cell Reference regexp in Calculation Engine to handle worksheet names containing quotes (#2617)
* Capture of worksheet name in Calculation Engine cell references modified to handle apostrophe and quote marks, and made non-greedy to avoid ensure that multiple quoted worksheet names in a formula aren't all captured in one go

* Split some of the unit tests into separate test classes
2022-02-22 15:55:59 +01:00
Mark Baker 3c57d9e291 Fix for issue #2614 (#2615)
* Fix for issue #2614

* Unit test (in ISREF() tests) that covers issue #2614
2022-02-22 09:06:10 +01:00
Mark Baker c9f948bd91 Initial work on implementing Array-enabled for the HLOOKUP() and VLOOKUP() functions (#2611)
* Initial work on implementing Array-enabled for the HLOOKUP() and VLOOKUP() functions

* In the MATCH() function, we should also use `evaluateArrayArgumentsIgnore()` because the lookupvalue and matchType arguments can be array arguments, but lookupArray is always a dataset matrix
2022-02-21 19:56:21 +01:00
Mark Baker db21d043fe Implementation of the ISREF() information function (#2613) 2022-02-21 18:47:23 +01:00
Mark Baker 0ee4d96576 Array-enable the ISFORMULA() function (#2610)
Implement Array-enabled for  ERROR.TYPE() function
Extract ERROR.TYPE() function tests into separate test file
Extract error function tests into separate test files

And thus complete the implemented Information functions
2022-02-20 19:32:13 +01:00
Mark Baker 35b65bef8c First steps toward array-enabling the information functions (#2608)
* First steps toward array-enabling the information functions

Also includes moving unit tests out from Functions and into a separate, dedicated Information folder

* Resolve issue with IF(), branch pruning and calculation cache (ensure that we don't convert the if condition to a bool before we've tested to see if it evaluates to an error)
More refactoring
2022-02-20 16:46:25 +01:00
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
MarkBaker 8e8e8f42b0 Apply float precision for unit tests 2022-02-19 14:15:25 +01:00
MarkBaker 31cf8fb749 Fix merge conflicts 2022-02-19 14:05:44 +01:00
MarkBaker 719df3c596 Merge branch 'master' into CalculationEngine-Array-Formulae-Initial-Work
# Conflicts:
#	src/PhpSpreadsheet/Cell/Cell.php
#	src/PhpSpreadsheet/Writer/Xlsx/Worksheet.php
2022-02-19 13:57:43 +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