PhpSpreadsheet/tests/data/Calculation
oleibman faf6d819c6
Keep Calculated String Results Below 32K (#2921)
* Keep Calculated String Results Below 32K

This is the result of an investigation into issue #2884 (see also PR #2913). It is, unfortunately, not a fix for the original problem; see the discussion in that PR for why I don't think there is a practical fix for that specific problem at this time.

Excel limits strings to 32,767 characters. We already truncate strings to that length when added to the spreadsheet. However, we have been able to exceed that length as a result of the concatenation operator (Excel truncates); as a result of the CONCATENATE or TEXTJOIN functions (Excel returns #CALC!); or as a result of the REPLACE, REPT, SUBSTITUTE functions (Excel returns #VALUE!). This PR changes PhpSpreadsheet to return the same value as Excel in these cases. Note that Excel2003 truncates in all those cases; I don't think there is a way to differentiate that behavior in PhpSpreadsheet.

However, LibreOffice and Gnumeric do not have that limit; if they have a limit at all, it is much higher. It would be fairly easy to use existing settings to differentiate between Excel and LibreOffice/Gnumeric in this respect. I have not done so in this PR because I am not sure how useful that is, and I can easily see it leading to problems (read in a LibreOffice spreadsheet with a 33K cell and then output to an Excel spreadsheet). Perhaps it should be handled with an additional opt-in setting.

I changed the maximum size from a literal to a constant in the one place where it was already being enforced (Cell/DataType). I am not sure that is the best place for it to be defined; I am open to suggestions.

* Implement Some Suggestions

... from @MarkBaker.
2022-07-04 08:30:46 -07:00
..
DateTime Calculation engine empty arguments (#2143) 2021-06-10 08:49:53 +02:00
DefinedNames Named formula implementation, and improved handling of Defined Names generally (#1535) 2020-07-26 12:00:06 +02:00
Engineering Extract information functions (#2605) 2022-02-19 13:53:17 +01:00
Financial Extract information functions (#2605) 2022-02-19 13:53:17 +01:00
Functions Escape double quotes in a string value unless it's an empty string value 2022-03-05 12:44:44 +01:00
Information Add basic support for Error functions when the error is #SPILL! or #CALC! 2022-03-18 17:44:26 +01:00
Logical Convert all relevant Logical functions to support array arguments (#2600) 2022-02-18 02:56:23 +01:00
LookupRef more minor tweaks 2022-03-16 23:03:19 +01:00
MathTrig Filter null values in PRODUCT() function, as they don't affect the calculation in any way, and actually require additional code handling if they're present within the calculation itself 2022-05-17 16:40:14 +02:00
Statistical Extract information functions (#2605) 2022-02-19 13:53:17 +01:00
TextData Keep Calculated String Results Below 32K (#2921) 2022-07-04 08:30:46 -07:00
Web Initial implementation of the URLENCODE() web function (#2031) 2021-04-28 17:10:36 +02:00
BinaryComparisonOperations.php Extract some methods from the Calculation Engine into dedicated classes (#2537) 2022-02-04 16:02:29 +01:00
Calculation.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
FunctionsAsString.php MATCH with a static array should return the position of the found value based on the values submitted. 2020-04-26 22:09:31 +09:00
Translations.php Resolve `translateSeparator()` method to handle separators (row and column) for array functions as well as for function argument separators; and cleanly handle nesting levels 2022-02-27 13:01:09 +01:00