Commit Graph

6033 Commits

Author SHA1 Message Date
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 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 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
oleibman b1f9014567 Fix Ods ListWorksheetInfo
It wasn't handling skipped rows and columns correctly.
2025-12-14 01:21:28 -08:00
oleibman 8120b652c4 Merge pull request #4745 from oleibman/sharedxls
Improve Coverage in Shared
2025-12-14 04:43:08 +00:00
oleibman 8f6acb6c4a Merge pull request #4743 from oleibman/sortsortby
Better Tests for SORT and SORTBY
2025-12-14 04:42:46 +00:00
oleibman 1daaad2576 Xlsx Reader ListWorksheetInfo Honor readEmptyCells
Fix #3255, another oldie (3+ years). Allow the ability to only count rows and columns with data. To avoid a breaking change, keep present logic unless Reader `readEmptyCells` attribute is set to its non-default value, i.e. `false`. This adds very little overhead, and gives a result that I think many users would prefer.
2025-12-13 20:14:11 -08:00
oleibman 11d60f6ace Add Sample for Sort By Column 2025-12-13 10:24:07 -08:00
Reinis Grinbergs 1bb6ae8ae5 Add content types when pass-through 2025-12-13 14:34:14 +01:00
oleibman c69133dc7e Additional ExponentialBestFit Test 2025-12-12 15:11:48 -08:00
oleibman 9199afc30d One More Test 2025-12-12 10:13:38 -08:00
oleibman 6cb44f2a63 More Tests for Logarithmic and Power Trends 2025-12-12 09:28:49 -08:00
oleibman 73138133cf More Tests for LinearBestFit 2025-12-12 07:43:02 -08:00
Reinis Grinbergs 7267164c41 pass-through media files and relationship 2025-12-12 09:36:58 +01:00
oleibman 9878dfb940 Trend Tests 2025-12-12 00:26:29 -08:00
oleibman 32161a7699 More Tests 2025-12-11 23:05:24 -08:00
oleibman 02d507984b Fix Test That Runs on Linux But Not Windows 2025-12-11 22:07:30 -08:00
oleibman 4169c51c7c Improve Coverage in Shared 2025-12-11 21:53:59 -08:00
oleibman d727455173 Document Excel's Behavior When Sorting Different DataTypes 2025-12-11 17:37:17 -08:00
oleibman f62034a752 Booleans
I don't know how Excel managed to mess up sorts involving booleans, but they did.
2025-12-10 14:57:02 -08:00
oleibman 9362d21bb5 Additional Test 2025-12-10 11:47:11 -08:00
oleibman 559ab2294a Better Tests for SORT and SORTBY
Current tests use only direct calls. Using them in spreadsheet context would be better.

There were some minor bugs. Excel treats an argument consisting of a single-cell as if it were a range; PhpSpreadsheet, which currently returns the content of the single cell, is changed to match that behavior, which is important if one of the other arguments causes a VALUE error.

Excel can do a column sort in SORTBY, despite the fact that Microsoft doesn't even mention that possibility in its documentation. I found documentation of that possibility on a 3rd-part site https://exceljet.net/functions/sortby-function, confirmed it in Excel, and took my best guess as to how to implement it. The existing test member for SORTBY included one such test, but it succeeds mostly by accident. The new member has a more reliable test.
2025-12-09 23:13:12 -08:00
oleibman 60aa9704b4 Merge pull request #4741 from oleibman/unseparate
Eliminate Unneeded Separate Process Tests
2025-12-09 08:02:02 +00:00
oleibman 0575e2062c Minor Modifications to Sample Names and Locations 2025-12-08 08:53:59 -08:00
oleibman 2c8177a319 Eliminate Unneeded Separate Process Tests
The tests stay; they just no longer run in separate processes. I think that only 2 tests still require separate processes - Helper/SampleTest and Tcpdf/NoDieTest. Aside from a new internal method in IOFactory, all the changes here are to test members.
2025-12-07 23:15:01 -08:00