Commit Graph

5579 Commits

Author SHA1 Message Date
oleibman d25979fae9 Merge pull request #4508 from oleibman/writestyles
Xlsx Style Writer Minor Refactoring
2025-06-18 04:59:57 +00:00
oleibman cb0f9c0414 Update CHANGELOG.md 2025-06-17 21:57:14 -07:00
oleibman 84acafc0bf Merge branch 'master' into writestyles 2025-06-17 21:35:23 -07:00
oleibman 0dbe154e29 Merge pull request #4503 from oleibman/issue4502
AutoColor for LibreOffice Dark Mode
2025-06-18 04:22:45 +00:00
oleibman 30369ca036 Merge pull request #4501 from oleibman/issue2760
Allow Xlsx Reader/Writer to Process Font Charset
2025-06-18 04:21:17 +00:00
oleibman 84b7ab93fa Merge pull request #4500 from oleibman/office2023theme
Support Current Office Theme
2025-06-18 04:20:29 +00:00
oleibman d38117ffe6 Eliminate Dead Statement 2025-06-12 16:48:59 -07:00
oleibman 04cfc57457 Xlsx Style Writer Minor Refactoring
In our unit tests, we can test the Worksheet Xml which PhpSpreadsheet will generate without having to actually write the spreadsheet to and read it from disk. This refactoring allows us to do the same for Styles, as demonstrated in the new StylesWriterTest.
2025-06-12 15:51:48 -07:00
oleibman f0ca95f8f9 Tests and Documentation 2025-06-10 07:14:38 -07:00
oleibman b91a9ef3f4 AutoColor for LibreOffice Dark Mode
See discussion #4502. I am not sure of what needs to be involved here. This is especially so because Excel also offers AutoColor, but its dark mode looks significantly different than LibreOffice's.

So here's what I've come up with thus far.
- Add boolean autoColor with setter and getter to Font.
- If autoColor is true, ODS writer and XLSX Writer will record it in the xml, and will not write a font color. It is possible that both can co-exist; I'm just not sure how they are supposed to interact if that is the case.
- It makes most sense to me if the spreadsheet's default font specifies autoColor, but PhpSpreadsheet will not insist on that.
- Xlsx Reader will process autoColor. Like most other styles, Ods Reader is not yet set up to handle it.
- LibreOffice Calc should follow the autoColor declarations when it reads either an Xlsx or Ods spreadsheet created by PhpSpreadsheet.
2025-06-05 22:19:12 -07:00
oleibman cbf194c905 WIP Allow Xlsx Reader/Writer to Process Font Charset
Fix #2760. Maybe. I have no real way of confirming. I am not sure why it might be needed, but a comment in the issue suggests that it helps. I have asked the submitter and another participant in the discussion to let me know if it helps before moving forward.
2025-06-03 21:41:21 -07:00
oleibman eb486262fa Support Current Office Theme
A while back, Microsoft introduced changes to the default theme colors and fonts. We are adding support for this new theme so that users can use it easily on new spreadsheets if they wish. (It is already supported when using the Xlsx Reader to load an appropriate file.) The old theme was described by constants COLOR_SCHEME_2013_PLUS_NAME and COLOR_SCHEME_2013_PLUS; these are deprecated in favor of COLOR_SCHEME_2013_2022_NAME and COLOR_SCHEME_2013_2022. The new theme is described by constants COLOR_SCHEME_2023_PLUS_NAME and COLOR_SCHEME_2023_PLUS. PhpSpreadsheet's default theme remains COLOR_SCHEME_2007_2010, to avoid breaking changes.

A third optional parameter `$spreadsheet` is added to setThemeColorName. If specified, the default font names for the theme will be applied to the default style for the spreadsheet. You can thus use the new theme with its relatively new default `Aptos Narrow` font. IMHO, that isn't necessarily a good choice, but it is available. MS stores the new font in a different location than other system fonts, and that can lead to portability problems, e.g. if your spreadsheet uses Aptos and you export it to Html, browsers will not be able to find the font and a substitute font will be used.
2025-06-03 21:36:05 -07:00
oleibman 44c3bd564b Merge pull request #4487 from oleibman/issue1154
Various Writers RichText TextElement Should Inherit Cell Style
2025-06-01 16:29:26 +00:00
oleibman 59387176e3 Update CHANGELOG.md 2025-06-01 09:26:35 -07:00
oleibman 277c8d5615 Merge branch 'master' into issue1154 2025-06-01 09:17:22 -07:00
oleibman 5c643a890b Merge pull request #4491 from oleibman/filterparm
Minor Changes to FILTER Function
2025-06-01 16:04:59 +00:00
oleibman df3a069722 Merge pull request #4493 from oleibman/torow
TOCOL and TOROW
2025-06-01 16:04:23 +00:00
oleibman bd792ec985 Merge pull request #4492 from oleibman/vstack
VSTACK and HSTACK
2025-06-01 16:04:06 +00:00
oleibman 1825c7428b Merge pull request #4498 from oleibman/stan2117
Upgrade Phpstan
2025-06-01 15:58:55 +00:00
oleibman f84724d13e Upgrade Phpstan
Too many problems with Dependabot update.
2025-06-01 08:41:13 -07:00
oleibman 02671e5c4f Merge pull request #4496 from PHPOffice/dependabot/composer/tecnickcom/tcpdf-6.10.0
Bump tecnickcom/tcpdf from 6.9.3 to 6.10.0
2025-06-01 13:37:00 +00:00
oleibman 173dd22c07 Merge pull request #4494 from PHPOffice/dependabot/composer/squizlabs/php_codesniffer-3.13.0
Bump squizlabs/php_codesniffer from 3.12.2 to 3.13.0
2025-06-01 13:36:43 +00:00
dependabot[bot] d7d4a04d27 Bump tecnickcom/tcpdf from 6.9.3 to 6.10.0
Bumps [tecnickcom/tcpdf](https://github.com/tecnickcom/TCPDF) from 6.9.3 to 6.10.0.
- [Changelog](https://github.com/tecnickcom/TCPDF/blob/main/CHANGELOG.TXT)
- [Commits](https://github.com/tecnickcom/TCPDF/compare/6.9.3...6.10.0)

---
updated-dependencies:
- dependency-name: tecnickcom/tcpdf
  dependency-version: 6.10.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-01 11:56:56 +00:00
dependabot[bot] 64bd02a5c5 Bump squizlabs/php_codesniffer from 3.12.2 to 3.13.0
Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.12.2 to 3.13.0.
- [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases)
- [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.12.2...3.13.0)

---
updated-dependencies:
- dependency-name: squizlabs/php_codesniffer
  dependency-version: 3.13.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-01 11:56:49 +00:00
oleibman f3c3aba618 TOCOL and TOROW
TOCOL and TOROW were introduced to Excel in 2024, and will now be supported by PhpSpreadsheet. The documentation says that, under certain circumstances, "blanks" will be ignored. This seems demonstrably wrong. In the right circumstance, Excel will ignore nulls, not blanks. Further, when it decides to not ignore the nulls, it changes them to 0, which also seems insufficiently documented. PhpSpreadsheet will behave as Excel does.

I discovered some minor problems and some missing test conditions for the TRANSPOSE function while testing these. Those are now fixed.
2025-05-28 23:15:06 -07:00
oleibman e83eae9be7 VSTACK and HSTACK
Fix #4485. VSTACK and HSTACK were introduced to Excel in 2024, and will now be supported by PhpSpreadsheet. Special thanks to @SlowFox71, who posted some code to implement VSTACK in the linked issue. I didn't have to change much between that version and the one in this ticket.

Excel has at least one idiosyncrasy with these functions. If you try to stack 2 tables with, say, `=VSTACK(TABLE1, TABLE2)`, Excel will silently change it to `=VSTACK(TABLE1[], TABLE2[])` and all will be well. This would be difficult for PhpSpreadsheet to do. The problem is that, when Excel reads the formula without the square brackets, it calculates it as a `#NAME?` error. This is baffling, and all the more so because you can "correct" it by editing the formula *without changing anything*, hit enter, and the formula will magically work again. So, if you plan to stack tables using PhpSpreadsheet, you're probably best off using the square brackets.
2025-05-27 19:53:30 -07:00
oleibman 347980a3cb Minor Changes to FILTER Function
Its first parameter is typed as `array`. Like all Excel spreadsheet functions, it should be `mixed` to avoid TypeErrors. If an argument other than an array is supplied, Excel will return VALUE, and now PhpSpreadsheet will do so as well. This had not been unit-tested. In fact, all the unit tests take place outside of spreadsheet context. New tests in spreadsheet context are added.
2025-05-26 19:10:09 -07:00
oleibman c00c2dfa59 Merge pull request #4490 from oleibman/changetypos
Changelog Typos
2025-05-26 19:15:25 +00:00
oleibman 19c04712dd Changelog Typos 2025-05-26 12:11:51 -07:00
oleibman d0ac70d610 Merge pull request #4489 from oleibman/issue4488
Regression in Date::stringToExcel
4.3.1
2025-05-26 18:51:08 +00:00
oleibman 1deff50416 Regression in Date::stringToExcel
Fix #4448.
2025-05-26 11:47:16 -07:00
oleibman 494efa4ab7 Move a Statement
No idea why this should help, but no better ideas.
2025-05-25 23:24:07 -07:00
oleibman ba079b3967 Various Writers RichText TextElement Should Inherit Cell Style
Fix #1154, which went stale over 5 years ago, and is now reopened. RichText elements can be a Run, which sets its own style, or a TextElement, which doesn't. As the issue states, TextElement handling is inconsistent. This PR forces it to inherit the style of the cell. As implemented, this will change it to a Run when it is read in, but there should be no practical difference as far as the end-user is concerned. There is no change as far as Run is concerned. The user suggested 3 options - TextElement and Run both inherit for any unspecified style elements, TextElement inherits and Run does not, neither inherits. Option 2 makes most sense to me. Option 1 may not even be possible (we can't tell if, say, the user explicityl set Italic to false, or if that was just the default choice).

Tests are added for all of Xlsx, Xls, and Html. Html reading of RichText elements is not well-supported. The tests are fairly difficult to understand. A new sample is added to demonstrate this change.
2025-05-25 21:22:12 -07:00
oleibman 13537148b1 Merge pull request #4486 from oleibman/changelog430
Prepare Changelog for 4.3.0
4.3.0
2025-05-26 03:42:48 +00:00
oleibman 9f40b9cfd0 Prepare Changelog for 4.3.0 2025-05-25 20:38:31 -07:00
oleibman 0552814d75 Merge pull request #4482 from oleibman/stan1009
Phpstan Level 10 (Final)
2025-05-26 03:25:00 +00:00
oleibman 68fd7119f3 Merge pull request #4479 from oleibman/issue4476
More Precision for Float to String Casts
2025-05-26 03:18:55 +00:00
oleibman 9da522f721 Merge pull request #4484 from oleibman/issue1247
Document That Precision As Displayed Is Not Supported
2025-05-25 07:28:12 +00:00
oleibman aab714ce11 Document That Precision As Displayed Is Not Supported
Fix #1247. Aside from being difficult to implement, see, for example, https://answers.microsoft.com/en-us/msoffice/forum/all/what-are-the-dangers-of-using-precision-as/1a2ba5eb-9470-452f-816e-d7961c0d0ad5
2025-05-25 00:14:51 -07:00
oleibman 170010076b Merge branch 'master' into issue4476 2025-05-24 22:30:13 -07:00
oleibman dbca68c1ab Additional Test 2025-05-24 22:28:35 -07:00
oleibman 3bb10ff88d Merge pull request #4478 from oleibman/hyperlinkstyle
Hyperlink Styles
2025-05-25 04:14:49 +00:00
oleibman 99f0e6a4e6 Merge branch 'master' into hyperlinkstyle 2025-05-24 21:12:00 -07:00
oleibman 31b4cadda9 Update CHANGELOG.md 2025-05-24 21:09:15 -07:00
oleibman 20df5edad7 Update recipes.md 2025-05-24 20:45:31 -07:00
oleibman e65bc8b8e2 Merge pull request #4483 from oleibman/compactlist
Compact Function List by Name Document
2025-05-25 03:19:27 +00:00
oleibman fcb5efc466 Merge pull request #4480 from oleibman/issue4477
Xlsx Reader Do Not Process Printer Settings for Dataonly
2025-05-23 19:06:51 +00:00
oleibman 0cbaf103d3 Update CHANGELOG.md 2025-05-23 11:43:47 -07:00
oleibman 365f9f1995 Compact Function List by Name Document
The entries in the "function list by name" document are very long, and almost all of them require horizontal scrolling, which is not very convenient for the end-user. This PR creates a "function list by name compact" document, in which `CATEGORY_` is stripped from all the category names and `PhpOffice\PhpSpreadsheet\Calculation\` is stripped from all the functions. I believe this eliminates the need to scroll horizontally within the document. I waffled on whether this should replace the existing document, or whether it should be an additional document. I decided there was probably some merit in keeping the old, and hardly any down-side, so, at least for now, we will generate both documents, and they will link to each other.

No changes to source code.
2025-05-23 08:32:52 -07:00
oleibman 5a9055ca6a Phpstan Level 10 (Final)
Fix all of Statistical. We can now use Level 10 going forward.
2025-05-22 17:48:30 -07:00