1550 Commits

Author SHA1 Message Date
oleibman c04a9389d3 Merge commit from fork
* Security Patch

* Throw Exception for EBCDIC Encoding

* Mixed UTF-8 and UTF-16

Further mischief. I don't know if the examples truly are valid Xml, but PhpSpreadsheet is letting them sneak through.
2024-11-10 01:07:59 -08:00
oleibman bd1b1e5237 Merge branch 'master' into issue4213 2024-11-06 05:48:06 -08:00
oleibman aba2385561 Merge branch 'master' into issue4200 2024-11-04 21:51:26 -08:00
oleibman a18abb3e0f Changes to ROUNDDOWN/ROUNDUP/TRUNC
Fix #4213. Early versions of Php 8.4 caused problems for some Excel functions, among them ROUNDDOWN and ROUNDUP. New code was added which seemed to work for 8.4 and all prior releases (back to 7.4). However, as the issue shows, there is a problem with the new logic that had not been a problem for prior releases (PhpSpreadsheet 1.29.1 with Php 8.3 or earlier).

As it happens, some time after 8.4 broke the existing functionality, new features were added to it which enabled much cleaner logic. The code will now take this cleaner path when available, and revert to the older logic when not. This appears to work for all relevant Php releases, at least till the next non-match between PhpSpreadsheet and Excel is reported.

And, having made the change to ROUNDDOWN, it occurred to me that ROUNDDOWN always returns the same result as TRUNC (they differ only in number of required arguments). So I changed TRUNC to call ROUNDDOWN, and that didn't break anything. So I will keep that change. This probably means I should change Calculation so that ROUNDDOWN is called automatically, and deprecate TRUNC. That can happen at a later time.
2024-11-04 19:23:53 -08:00
oleibman ebdde3dcf9 Write ignoredErrors Tag Before Drawings
Fix #4200. Fix #4145. Although the Xml is valid, Excel insists that worksheet.xml specifies `ignoredErrors` (introduced with 1.29.0) before `legacyDrawing` or `drawing`.
2024-11-01 09:20:45 -07:00
oleibman 5bfe7d36e2 Merge branch 'master' into issue4197 2024-10-30 14:46:30 -07:00
oleibman 5f91c03904 Scrutinizer (legit) 2024-10-27 15:02:05 -07:00
oleibman d06230eaf4 Allow ANCHORARRAY as Valid DataValidation List
Fix #4197. Overlooked in the introduction of Dynamic Arrays, Data Validation can specify a list to be a result of the spill operator, which is implemented via the ANCHORARRAY function.

It appears that function `DataValidator::isValid` will not work if the list is specified in this manner, nor if it is specified as a defined name. Fixing those situations will be difficult (defined names probably easier than ANCHORARRAY), and there is no reason to delay this change waiting for those to be fixed. I will open a new issue when this PR is merged.
2024-10-27 14:16:42 -07:00
oleibman c42004844d Add setLabelFont to Chart/Layout
Fix #4201. Although that issue can be dealt with without any change to PhpSpreadsheet, it is pretty clear that `setLabelFont` has been accidentally omitted from Chart/Layout. Add it now. Xlsx Chart Writer is changed to use font name from labelFont if latin, eastAsian, or complexScript is uninitialized. Finally, chart label font size is multiplied by 100 in Xlsx Writer, as it is in Excel, but the corresponding division by 100 has been omitted from Xlsx Chart Reader - add that now.
2024-10-27 13:50:21 -07:00
oleibman 753732b5c3 Merge branch 'master' into csvphp9 2024-10-14 21:12:16 -07:00
oleibman c14a1e623b Merge branch 'master' into issue562 2024-10-12 23:15:21 -07:00
oleibman 62a0d40f13 Merge branch 'master' into issue2157 2024-10-12 22:30:13 -07:00
oleibman f981ef95c9 Minor Tweak 2024-10-11 14:06:10 -07:00
oleibman 9fe3d71518 Merge branch 'master' into valuebinder 2024-10-09 17:34:48 -07:00
oleibman 545b098acd Method to Test Whether Csv Will Be Affected by Php9
See #4161. The best way to future-proof is to set the escape character to null string, and set testAutoDetect to false before reading. However, depending on the file being read, this may lead to different results than expected. This will be unavoidable because Php itself will change. This PR adds a new static method `affectedByPhp9` to Csv Reader. This can be used to identify in advance whether an input file will be affected by the changes. This will allow users to identify problems in advance, and prepare for how they might be handled.
2024-10-09 07:07:16 -07:00
oleibman 7a1370c869 Allow Omitting Chart Border
Fix #562.
2024-10-09 06:37:25 -07:00
oleibman bd92aebec6 Merge branch 'master' into issue1107 2024-10-09 05:28:29 -07:00
oleibman 7471ca8bf6 Merge branch 'master' into issue1412 2024-10-07 21:09:59 -07:00
oleibman d2b3a8d5f7 Merge branch 'master' into imgtransparent 2024-10-07 10:50:37 -07:00
oleibman c6ede15401 Merge pull request #4148 from oleibman/stan9again4
Better Definitions for Mixed Parameters and Values Part 4 of Many
2024-10-07 17:31:02 +00:00
oleibman 32cb9f488f Excel 2003 Allows Html Entities
Fix #2157. Excel 2003 format allows some things which a real Xml parser would reject. In particular, it permits Html entities, and leading whitespace. Change Xml Reader to do likewise.
2024-10-06 09:32:11 -07:00
oleibman c1ad483670 Merge branch 'master' into issue4182 2024-10-06 08:52:36 -07:00
oleibman dab6ba83e4 SUMIFS Does Not Require _xlfn
Fix #4182. It was on our list as "introduced in 2019". It was, in fact, available with Excel 2007 (https://support.microsoft.com/en-us/office/excel-functions-alphabetical-b3944572-255d-4efb-bb96-c6d90033e188#bm19), so does not require a prefix when writing it to a spreadsheet.
2024-10-06 08:35:26 -07:00
oleibman 1b64b42481 Add Dynamic valueBinder Property to Spreadsheet and Readers
Fix #1395, a 2020 issue which had been marked stale and is now re-opened. Static valueBinder property of Cell isn't ideal. It would be more flexible to make it a dynamic property of the spreadsheet. Static property will continue to be used, but dynamic property will be used first if it is set. Readers will also be changed to add a valueBinder property which they pass to the spreadsheet; however, it will make a difference only for Csv/Html/Slk, since the other readers use setValueExplicit which ignores valueBinder.

Documentation is updated in several places to note that dynamic property is preferred over static.
2024-10-05 23:59:44 -07:00
oleibman 6382dba985 Invalid Html Due to Cached Filesize
Fix #1107. Clear statcache for file before requesting its size.
2024-10-05 23:15:57 -07:00
oleibman 13c3ec9692 Merge pull request #4180 from oleibman/issue4179
Xlsx Writer Duplicate ContentTypes Entry for Background Image
2024-10-06 05:31:12 +00:00
oleibman 44014f84ac Merge pull request #4152 from oleibman/issue3185
Xls Writer Conditional Rules Applied to Whole Rows or Columns
2024-10-06 05:21:39 +00:00
oleibman db7d4a76ea Xlsx Writer Duplicate ContentTypes Entry for Background Image
Fix #4179. Sheet has a background image, and the code is not properly accounting for the image's extension already being defined in ContentTypes, resulting in what Excel thinks is a corrupt file.
2024-10-01 16:49:07 -07:00
oleibman 094ed465ea Update URLImageTest.php 2024-09-29 05:40:23 -07:00
oleibman 4a200ccf70 Merge branch 'master' into imgtransparent 2024-09-29 04:50:37 -07:00
oleibman 512c21e808 Add Disconnects 2024-09-24 17:27:33 -07:00
oleibman 1d73598d67 Restore 2 Disabled Tests
For some https requests for file_get_contents, "context" needs to be added to function call. It is not clear why this has changed recently.
2024-09-24 17:10:37 -07:00
oleibman 7366a16cd7 Disable 2 Tests
Test for url image used file_get_contents on file which we have read successfully for years. Today it started returning error 403. Disable tests while I study whether there is a suitable replacement.
2024-09-23 22:01:40 -07:00
oleibman 4b8a929fc1 Merge commit from fork
* Validate Mime Type for Images

* Extend Change to Xlsx Reader

* Attach Drawing to Sheet Only If Valid

* Suppress Some Theoretical Warning Messages

* Minor Tweak
2024-09-23 13:28:31 -07:00
oleibman 2d493d731b Merge commit from fork 2024-09-14 05:20:37 -07:00
oleibman 63ccb02ab9 Merge commit from fork
* Check for Whitespace Around Xml Encoding

* More Tests
2024-09-13 18:17:30 -07:00
oleibman 83f2d8692c Validate Mime Type of Image Files 2024-09-11 07:49:46 -07:00
oleibman 381584309e Merge pull request #4165 from oleibman/dompdf84
Dompdf and Php8.4
2024-09-08 02:55:35 +00:00
oleibman 995d9c794e Dompdf and Php8.4
Lots of deprecation messages. They are a major distraction at this stage. Suppress them until Dompdf is fixed.
2024-09-07 18:01:26 -07:00
oleibman fd9656689e Merge pull request #4150 from marc-mabe/fix-Date-roundMicroseconds
Fix Date::roundMicroseconds() not resetting microsecond part
2024-09-05 16:53:12 +00:00
oleibman bba5719da2 Merge branch 'master' into issue4128b 2024-09-04 19:35:20 -07:00
oleibman 8249cbd375 Scrutinizer 2024-08-30 12:45:34 -07:00
oleibman c11524d1a5 Performance Problem With Some Spreadsheets 2024-08-30 12:21:46 -07:00
oleibman 9498c03c8b Xls Writer Conditional Rules Applied to Whole Rows or Columns
Fix #3195. Applying a conditional style to an entire row or column applies the Excel 2007+ limits (16,384 columns and 1,048,576 rows). However, Excel 2003- has different limits (256 columns and 65,536 rows). Trying to use the larger limits in an Xls spreadsheet results in a corrupt file. Xls Writer is changed to adjust ranges appropriately.

The issue also mentions that there might be a problem if a spreadsheet contains CF rules for both whole rows and whole columns. I am unable to corroborate this; the code from the new test can be used to generate an Xls file which is usable, and which has both row and column conditional styles.

However, testing showed that Xls Writer did not handle conditions correctly for floating point, negative integers, or integers > 65535. These should now be handled correctly.
2024-08-29 23:35:09 -07:00
oleibman f9192006cd Merge pull request #4143 from oleibman/deprecated2
Remove Deprecations from Release 2
2024-08-29 15:24:10 +00:00
oleibman 3e7751e363 Restrict Protocols for Html Hyperlinks
Render hyperlink as text if it begins with a string of word characters followed by colon, unless the string is one of http, https, file, ftp, or s3.
2024-08-28 12:27:47 -07:00
oleibman debb07a9fb Merge pull request #4144 from oleibman/issue1402
VLOOKUP Handling of Strings and Number
2024-08-28 15:06:11 +00:00
Owen Leibman 1618607b96 Option to Write Hyperlink Rather than Label to Csv
Fix #1412 which had gone stale and which I've reopened. Add boolean property `preferHyperlinkToLabel` with setter and getter to Csv Writer. Default is false, so no BC problems; in addition, true will probably add quite a bit of overhead.
2024-08-26 12:56:27 -07:00
Marc Bennewitz cd8e83735b Fix Date::roundMicroseconds() not resetting microsecond part 2024-08-26 14:32:10 +02:00
Owen Leibman 826451937e Better Definitions for Mixed Parameters and Values Part 4 of Many
Continuing work started with PR #4016, PR #4026, and PR #4060. Improve documentation within program by making explicit what types of values are allowed for variables described as "mixed". In order to avoid broken functionality, this is done mainly through doc-blocks. This will get us closer to Phpstan Level 9, but many changes will be needed before we can consider that.

After this PR, 231 changes remain, all in src/Calculation.
2024-08-24 22:08:13 -07:00