Commit Graph

6055 Commits

Author SHA1 Message Date
oleibman dade50db8d Update CHANGELOG.md 2026-01-03 17:59:34 -08:00
oleibman f0e76a44c2 Test Member Was Misnamed
Caused some tests (and coverage) to be missed. Rename it properly.
2026-01-01 17:26:38 -08:00
oleibman 60a04419cc Rowspan in Html
Fix #1319, which went stale in 2020, and is now reopened. Rowspan is not showing up when saving some spreadsheets as Html. There is some logic concerning property `isSpannedRow` which indicates that this is deliberate, but I have no idea what purpose it serves. It leads directly to this issue, and also adversely affects (in a minor way) some samples (e.g. 17a_Html), where merged cells maintain their text but lose their top and bottom padding. After discarding this logic, the reported problem goes away, the samples look better, and no tests fail. So, whatever its purpose, it wasn't tested for. This PR permanently removes the property, and adds a little additional bulletproofing. A minor accommodation is needed for Tcpdf in one place.

This PR probably deletes more lines from Html Writer than it adds. It would not surprise me if this is one of those unusual cases where Coveralls reports a decrease in coverage despite the fact that all the new code is covered.
2026-01-01 16:34:56 -08:00
oleibman 0544868f90 Merge pull request #4765 from oleibman/issue820
SUBTOTAL and Hidden Rows
2025-12-31 21:18:31 +00:00
oleibman 6af5379b6b Update CHANGELOG.md 2025-12-31 13:15:45 -08:00
oleibman 947cdeeeeb Merge pull request #4764 from oleibman/issue993
Drawing Hyperlink
2025-12-31 20:56:49 +00:00
oleibman 7450f46459 Update CHANGELOG.md 2025-12-31 12:53:53 -08:00
oleibman f17dfc9921 Merge pull request #4763 from oleibman/mergedstyles
Merge Cell Basic, Table, and Conditional Styles
2025-12-31 20:42:22 +00:00
oleibman 2fc7b9be52 Update CHANGELOG.md 2025-12-31 12:39:33 -08:00
oleibman c57be91754 Coverage Tweak 2025-12-31 10:49:33 -08:00
oleibman b24daf8d8a Better Support of Hyperlink Display Attribute
This attribute is written by Xlsx Writer, using the `tooltip` attribute, introduced by PR #904 in 2019. It is ignored by Excel, but may be used by Google Sheets (see issue #807). If it is used by anyone, it should be supported by Xlsx Reader, and exist as its own attribute in the `Hyperlink` class. Writer will continue to use tooltip if the new attribute isn't set.
2025-12-31 09:32:02 -08:00
oleibman 391a0a7f31 SUBTOTAL and Hidden Rows
Fix #820, which went stale in 2019 and is now reopened. Another weird Excel implementation detail. When SUBTOTAL's first argument is 101 through 111, it excludes all hidden rows. When that argument is 1 through 11, it excludes all rows which are hidden due to an auto-filter, but includes rows which were manually hidden. PhpSpreadsheet had not been distinguishing between the two types of "hidden-ness". Add a new property to RowDimension to indicate whether it is hidden due to an auto-filter, and use that property when evaluating SUBTOTAL 1-11.
2025-12-30 15:10:50 -08:00
oleibman 93c84c231f Drawing Hyperlink
Fix #993, which went stale in 2019 and is now reopened. It was not explicitly stated in the documentation, but Xlsx supports hyperlinks when clicking on a drawing. User tried to use the same format for internal hyperlink that is documented for cell internal hyperlink, and that failed (corrupt spreadsheet, hyperlink doesn't work). That was because Xlsx uses `#` rather than `sheet://`. For drawings, Xlsx Writer will now automatically convert `sheet://` to `#`, and Xlsx Reader will now convert the other way. No change is needed for cell hyperlinks. Documentation is now updated, including a statement that drawing hyperlinks work only for Xlsx.
2025-12-30 12:22:39 -08:00
oleibman 0511d297fe Accidentally Disabled Test 2025-12-29 17:43:20 -08:00
oleibman 6fbeeb705b Use Default Style for Unstyled Tables
Using a default style looks better than leaving them unstyled. User has ability to ignore unstyled tables as before, but I don't know why one would want to.
2025-12-29 17:34:55 -08:00
oleibman 66ba5a8418 Merge pull request #4762 from oleibman/filterexif
Dependencies
2025-12-29 21:37:17 +00:00
oleibman d53a8e5dde Merge pull request #4761 from oleibman/htmlwarn
Suppress Libxml Warnings in Reader/Html
2025-12-29 21:28:02 +00:00
oleibman d502dc5437 Coverage Tweaks 2025-12-29 12:53:52 -08:00
oleibman 167028c3ec Merge Cell Basic, Table, and Conditional Styles
Fix #1058, which went stale in 2019 and is now reopened. PR #4412 added support for Conditional Styles and partial support for Table Styles to Html Writer. This PR refactors that code by moving it to a new `Styles\ConditionalFormatting\MergedCellStyle` class, which will be used by Html Writer, and can be used in other circumstances. Note that Excel's builtin table styles don't contain the information we need to support them, but custom table styles are supported.
2025-12-28 23:08:17 -08:00
oleibman 2241b2ca00 A Bit More Coverage 2025-12-27 17:20:49 -08:00
oleibman 2bb1c9df3c Dependencies
A dependency checker found the following minor problems:
- `TIMEVALUE` uses the wrong case for `DateTime`.
- The `filter` extension is used but is not declared as a dependency.
- The `exif` extension is used but is not declared as a dependency.

Php tolerates the first, but the solution is so trivial that it might as well be applied.

You have to go out of your way to not include `filter` - is it almost always builtin. Nevertheless, it shouldn't hurt to explicitly declare it.

`exif` is used in only one place, and, if it's not available there, we fall back to `GD`, which *is* a dependency. Getting rid of the `exif` portion should be harmless.
2025-12-27 16:15:30 -08:00
oleibman 2a43cb4202 Coverage Tweak 2025-12-27 15:24:28 -08:00
oleibman 7fb028df51 Improve Coverage 2025-12-27 12:56:51 -08:00
oleibman 32e59142a3 Suppress Libxml Warnings in Reader/Html
Fix #647, which went stale in 2019 and is now reopened.

Fix #849, which went stale in 2019 and is now reopened.

Html Reader currently echoes any warning messages from Dom::loadHtml when it parses Html input. These are generally not needed, and may cause PhpSpreadsheet to fail needlessly. A new property `$suppressLoadWarnings` is added. It will additionally default to `null`, which will avoid any BC breaks. However, the default will be changed to `true` in a future release. Should the caller be interested in any messages which are suppressed when `true` is in effect, these are available through new method `getLibxmlMessages` after the Html has been loaded.
2025-12-27 11:16:45 -08:00
oleibman 1a01a22d2b Merge pull request #4760 from oleibman/intllocales
Set All Locale Variables at Once in a Threadsafe Manner
2025-12-27 05:00:37 +00:00
oleibman c0e77c993f Miscellanea 2025-12-26 18:21:37 -08:00
oleibman dc4582b9ed Mark Some Properties Used Only For Testing as Internal 2025-12-26 08:35:12 -08:00
oleibman 677a9a6269 Additional Test 2025-12-25 21:26:59 -08:00
oleibman f31e621d0d Update Changelog 2025-12-25 19:50:05 -08:00
oleibman 31174c1c90 Set All Locale Variables at Once in a Threadsafe Manner
Fix #954, which went stale 6 years ago and which I have now reopened. The `setLocale` method in `Calculation` and `Settings` does not affect the 3 localizable properties in `StringHelper` - `currencyCode`, `decimalSeparator`, and `thousandsSeparator`. One way to work around this problem is to set those properties separately; this is probably how most people handle it. Another way is to call Php's own `setlocale` function; this does not require any foreknowledge of what the values need to be, but it comes with baggage (data is maintained at process level rather than thread level), so its use is discouraged.

This PR adds a new `setLocale` method to `StringHelper`. It sets the 3 properties and the `Calculation` language all at once. It depends on the `Intl` extension, which is a recommendation but not a formal requirement for PhpSpreadsheet; the method will return `false` if `Intl` is not available or it thinks the supplied locale is not valid.
2025-12-25 19:24:44 -08:00
oleibman 212fac60e9 Merge pull request #4759 from oleibman/studenttlocale
T.INV Don't Use Locale-Aware sprintf
2025-12-25 00:50:05 +00:00
oleibman d7f59e225e T.INV Don't Use Locale-Aware sprintf
Uppercase f to F, add test.
2025-12-24 16:45:40 -08:00
oleibman bec13757a8 Merge pull request #4753 from oleibman/clonebug
Fix Clone Spreadsheet With Defined Names
2025-12-23 06:58:37 +00:00
oleibman bdcc300c6d Merge branch 'master' into clonebug 2025-12-22 22:50:54 -08:00
oleibman 5cae60730b Update CHANGELOG.md 2025-12-22 22:50:09 -08:00
oleibman d3a7e4493c Merge pull request #4751 from oleibman/webservice2
Changes to WEBSERVICE
2025-12-23 05:43:41 +00:00
oleibman e9cc5b1226 Fix Clone Spreadsheet With Defined Names
When a spreadsheet containing defined names is cloned, the worksheets pointed to by the defined names in the cloned spreadsheet are actually clones of the intended worksheets. Fix this, add tests.
2025-12-22 09:48:34 -08:00
oleibman 9bc3a73ba4 Make White List Instance Property Rather than Static 2025-12-21 22:31:45 -08:00
oleibman 2ce3ac1a90 Wrong Case for Directory Name 2025-12-19 10:24:21 -08:00
oleibman 84747121a1 Changes to WEBSERVICE
This PR started because the documentation on how to configure an Http client was out of date. However, as I investigated further, I found problems. GuzzleHttp, a client mentioned in the documentation, for example - it probably works fine when executed from a browser, but it does not work for `https:` requests from the Windows command line. See https://github.com/guzzle/guzzle/issues/2601, where a user notes that Guzzle's own program to demonstrate how to use it doesn't work, a result that I can confirm is still true. A linked explanation says that the solution is to explicitly specify a path to a CA bundle. For starters, this is impractical from our perspective. One possible solution is to change a php.ini option which is not needed for any other purpose, and which probably needs to change frequently - a burden on users who follow that route. An alternative solution is to use a method `request` to specify the path to the certificate store; this also will need to change from time to time, and, worse, the only method defined in ClientInterface is `sendRequest`, so using this solution isn't client-agnostic, which is a stated goal of https://github.com/PHPOffice/PhpSpreadsheet/commit/7cb4884b96174eb611621635e6fb603ef54178f7. Additionally, it is not clear why an external interface is needed rather than a call to file_get_contents, used elsewhere in PhpSpreadsheet, and not requiring a path to a certificate store.

I also believe that automatically evaluating WEBSERVICE for any arbitrary argument is not a good idea. I am adding a domain whitelist which the user must populate. For domains not in the whitelist, the calculation will revert to `oldCalculatedValue`, which is good enough for pass-through purposes, which probably encompasses most cases. That is how Excel behaves by default - it disables WEBSERVICE calls when it opens a spreadsheet which contains them. For cases where the user adds a new WEBSERVICE call, there is a choice of whitelisting the domain, or getting the result in some other way and using `setCalculatedValue` to store it.

Finally, when a WEBSERVICE call *is* evaluated, it will now accept a cell-address argument rather than just a literal string as is now the case.
2025-12-19 10:12:50 -08:00
oleibman f2acc0afbb Merge pull request #4748 from oleibman/studentt
Fix Some Functions Related to Student-T Distribution
2025-12-17 16:37:45 +00:00
oleibman 6d27759bcc Update Changelog 2025-12-17 08:33:41 -08:00
oleibman 33ebb15ba4 Delete No Longer Needed Statement 2025-12-16 22:26:34 -08:00
oleibman 591ef9acd9 Implement Rest of T.DIST
Found an algorithm for T.DIST  when third argument is FALSE.
2025-12-16 21:34:59 -08:00
oleibman 5b4d7fcdc8 Partial Implementation of T.DIST
T.DIST takes 3 parameters. When the 3rd parameter, a boolean, is true, we now have code to support the request. We still do not have code to handle the false case.
2025-12-16 17:10:53 -08:00
oleibman 06d2799528 Forgot to Remove a Placeholder Function 2025-12-15 17:17:27 -08:00
oleibman 5eb46bd48e Fix Some Functions Related to Student-T Distribution
Fix #4167. That problem was initially reported as a problem with TINV, however, at its root, it was actually a problem with TDIST (which TINV needs to call). Both of these are deprecated by Microsoft in favor of some newer functions. PhpSpreadsheet incorrectly treated T.INV as an alias for TINV, and did not implement T.INV.2T, which actually is an alias for TINV.

To solve this problem, I adapted the Perl CPAN module `Statistics::Disttributions`, written by Michael Kospach around 2003. Unit test results have been manually checked against Excel; a few had to be changed because they were wrong (see the original issue). I believe that all of TDIST, T.DIST.2T, T.DIST.RT, TINV, T.INV, and T.INV.2T now function correctly, at least most of the time. I have not found code or an algorithm that I can use for T.DIST nor for T.TEST, both of which remain unimplemented.
2025-12-15 16:53:30 -08:00
oleibman 09f1a57e53 Merge pull request #4746 from oleibman/issue3255
ListWorksheetInfo Improvements for Xlsx and Ods
2025-12-14 16:12:42 +00:00
oleibman f6b0668422 Update Changelog 2025-12-14 08:08:10 -08:00
oleibman a67339973c Merge pull request #4712 from rpg600/5.1.0-patched
feat: add drawing pass-through support for unsupported elements
2025-12-14 09:36:51 +00:00