Commit Graph

6207 Commits

Author SHA1 Message Date
oleibman 79cfd9cfc4 Correct Underline, Resurrect Test 2026-02-14 17:59:37 -08:00
oleibman 391462f10f Ods Reader Style Support Part 1 - Fonts and Solid Fill
Fix #2622. Fix #1191 (stale as of 2020 but just reopened). A long overdue addition. Ods Reader has till now not supported any styles (although PR #4806 added some support for number formats). This will be the first of several PRs to rectify this situation.

Ods Reader Changes
- Default font
- Font
    - autoColor
    - bold
    - color
    - italic
    - font-family (name)
    - size
    - underline
- Fill (type=Solid only)
    - startColor

Ods Writer Changes
- Default font
- Font
    - strikethrough (fix #4808)
    - size currently always writes to xml with one decimal point, will now eliminate `.0`

Ods Reader changes still to come
- Default fill, border, alignment, protection
- Font
    - subscript
    - superscript
- Fill
    - types other than Solid
- Alignment
- Borders
- Protection

Ods Writer changes still to come
- Default fill, border, alignment, protections
2026-02-14 16:59:11 -08:00
oleibman 91d7d1b100 Merge pull request #4806 from oleibman/odsnumberformat2
Ods Writer Support Some Number Formats
2026-02-12 16:02:38 +00:00
oleibman c1206fd3b1 Add NumberFormat Callback to Reader 2026-02-11 22:39:27 -08:00
oleibman 53a72cb18a Slight Improvements for Currencies 2026-02-11 17:15:52 -08:00
oleibman 178d34b9cc Coverage Tweak 2026-02-11 01:18:32 -08:00
oleibman fb55d1b6e4 Ods Writer Support Some Number Formats
Redo of PR #4799 due to failed attempt to resolve merge conflict.

Fix #4798. Partially address #3961. Ods Reader supports very little related to styling. Ods Writer supports many styling details, but has not heretofore supported Number Formatting. 3961 addresses both issues; I created 4798 specifically for the Writer side.

Writing number formats to Excel is pretty simple - you just supply a string and that is used directly in the Xml. Ods is much more complicated - it requires Xml nodes that give a complete description of the styling. For that reason, it is difficult and painstaking to convert from the string that Excel (and PhpSpreadsheet) uses to what Ods requires.

This PR provides code to support almost all the styles defined as constants in Style/NumberFormat. It also allows the user to add code to handle otherwise unhandled styles. New Sample55_DefinedStyles demonstrates the use of all the constant styles, plus the addition of a couple of custom styles. I may be amenable to adding some unsupported styles to the built-in list, but the custom style option will always be around in case I am being slow or unreasonable.

This PR does not fully support Ods Reader handling of styles. However, based on the new Writer output, it will often be able to guess the true type of numeric items and assign an appropriate style for that type. So, for example, if it can identify the field as a date, it will assign a date style. It will not always match the style in the sheet being read, but it is a big advance from just formatting the data as a generic number.
2026-02-10 23:48:49 -08:00
oleibman 8f5c11bc9f Merge pull request #4803 from QDenka/fix/ods-read-filter-repeated-columns
Fix ODS reader column misalignment with read filter and number-columns-repeated
2026-02-11 04:07:28 +00:00
oleibman 6252ff325e Merge branch 'master' into fix/ods-read-filter-repeated-columns 2026-02-10 20:03:51 -08:00
oleibman ee673e1f70 Update CHANGELOG.md 2026-02-10 20:02:57 -08:00
oleibman ff03307cce Merge pull request #4801 from IndrekHaav/css-size
Add support for image CSS size in millimetres
2026-02-11 03:51:37 +00:00
oleibman 81bcc19c75 Update CHANGELOG.md 2026-02-10 19:47:44 -08:00
oleibman f79394beb4 Merge pull request #4793 from oleibman/listpix
Option to Whitelist External Images
2026-02-11 03:36:17 +00:00
oleibman 856d15f8b0 Update CHANGELOG.md 2026-02-10 19:32:34 -08:00
QDenka b392854c9c Fix ODS reader column misalignment with read filter and number-columns-repeated
When using a read filter with the ODS reader, cells with
table:number-columns-repeated containing data were incorrectly handled.
The read filter was only checked for the first column of a repeated
group - if it didn't pass, the entire group was skipped, even if
other columns within the range should have passed the filter.

This caused column data misalignment where filtered columns would
either be missing or contain data from wrong positions.

The fix ensures that:
1. When the first column of a repeated group fails the filter, the
   reader checks if ANY column in the group passes before skipping
2. During data writing, each repeated column is individually checked
   against the read filter

Fixes PHPOffice/PhpSpreadsheet#4802
2026-02-08 13:54:04 +00:00
Indrek Haav eafca4a3a8 Add unit tests 2026-02-07 00:23:56 +02:00
Indrek Haav fc3279c594 Fix phpcs errors 2026-02-07 00:11:57 +02:00
Indrek Haav 9f98525f03 Fix Phpstan errors 2026-02-06 22:32:28 +02:00
Indrek Haav d52f556f2d Fix implicit conversion errors when CSS sizes contain or result in fractions 2026-02-06 12:42:33 +02:00
Indrek Haav 0461a2bcd4 Add support for CSS sizes in millimetres 2026-02-06 12:41:08 +02:00
oleibman 95b826a3c8 Merge pull request #4797 from oleibman/issue4061
Strange Behavior of CONCATENATE
2026-02-06 02:32:00 +00:00
oleibman 40d9a3070f Update CHANGELOG.md 2026-02-05 18:28:11 -08:00
oleibman ba99bd148e Add Test 2026-02-02 20:16:35 -08:00
oleibman d63e6b1584 Reorganize 2 Tests 2026-02-02 12:40:56 -08:00
oleibman 14686fb3d9 Reorganize 2 Tests 2026-02-02 12:39:31 -08:00
oleibman 70768bd5d2 Coverage Tweaks 2026-02-01 14:10:58 -08:00
oleibman 9bd828e25d Strange Behavior of CONCATENATE
Fix #4061. CONCATENATE, which has slightly different behavior than CONCAT, and which MS has deprecated for that reason, behaves in an unexpected way when a cell range is presented to it and the spreadsheet does not allow for array results. This would almost certainly occur only for Legacy spreadsheets, but such is what was presented in the issue. The code is changed so that when an array of cells is presented to CONCATENATE, and RETURN_ARRAY_AS_VALUE is in effect, the array will be treated as if it were wrapped in the SINGLE pseudo-function (which is what Excel does by somewhat mysteriously prefixing the cell range with `@`).

This is a niche case. This one stands out because of its deprecation and replacement function. It is possible that other functions exhibit this behavior. I have made no attempt to identify others. A similar approach can probably be applied if issues are raised for others.
2026-02-01 08:51:39 -08:00
oleibman 3e15179c53 Merge pull request #4796 from PHPOffice/dependabot/composer/phpstan/phpstan-phpunit-2.0.12
Bump phpstan/phpstan-phpunit from 2.0.11 to 2.0.12
2026-02-01 16:26:39 +00:00
oleibman daca2fc7ff Merge pull request #4795 from PHPOffice/dependabot/composer/friendsofphp/php-cs-fixer-3.93.1
Bump friendsofphp/php-cs-fixer from 3.92.3 to 3.93.1
2026-02-01 16:20:37 +00:00
oleibman 65b54ae336 Merge pull request #4794 from PHPOffice/dependabot/composer/phpstan/phpstan-2.1.38
Bump phpstan/phpstan from 2.1.33 to 2.1.38
2026-02-01 15:52:44 +00:00
dependabot[bot] 97e91caf30 Bump phpstan/phpstan-phpunit from 2.0.11 to 2.0.12
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 2.0.11 to 2.0.12.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/2.0.11...2.0.12)

---
updated-dependencies:
- dependency-name: phpstan/phpstan-phpunit
  dependency-version: 2.0.12
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-01 11:01:15 +00:00
dependabot[bot] b4f503896a Bump friendsofphp/php-cs-fixer from 3.92.3 to 3.93.1
Bumps [friendsofphp/php-cs-fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer) from 3.92.3 to 3.93.1.
- [Release notes](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases)
- [Changelog](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/compare/v3.92.3...v3.93.1)

---
updated-dependencies:
- dependency-name: friendsofphp/php-cs-fixer
  dependency-version: 3.93.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-01 11:01:09 +00:00
dependabot[bot] 4af74bc217 Bump phpstan/phpstan from 2.1.33 to 2.1.38
---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-version: 2.1.38
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-01 11:01:00 +00:00
oleibman c1eb8e90d7 Merge pull request #4789 from oleibman/pdfhdrtlr
Headers and Footers in Pdf
2026-01-31 20:16:22 +00:00
oleibman 6bbeb49026 Update CHANGELOG.md 2026-01-31 12:12:38 -08:00
oleibman 5b220b87db Minor Reorg 2026-01-31 09:25:36 -08:00
oleibman c9b01653e7 Coverage Tweak 2026-01-31 00:40:47 -08:00
oleibman 50a7552f12 Option to Whitelist External Images
Loading external images from a spreadsheet can subject the caller to security exploits. For those who think they need something between not loading any external images (the default and our strong recommendation) or loading them all unconditionally (the current alternative), a callback can now be provided to indicate whether a specific image is okay to load. We continue to urge caution in using this option.
2026-01-30 22:43:21 -08:00
oleibman 987489f508 Merge pull request #4792 from PHPOffice/dependabot/composer/symfony/process-6.4.33
Bump symfony/process from 6.4.26 to 6.4.33
2026-01-28 22:54:07 +00:00
dependabot[bot] 344899f50a Bump symfony/process from 6.4.26 to 6.4.33
Bumps [symfony/process](https://github.com/symfony/process) from 6.4.26 to 6.4.33.
- [Release notes](https://github.com/symfony/process/releases)
- [Changelog](https://github.com/symfony/process/blob/8.1/CHANGELOG.md)
- [Commits](https://github.com/symfony/process/compare/v6.4.26...v6.4.33)

---
updated-dependencies:
- dependency-name: symfony/process
  dependency-version: 6.4.33
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-28 22:07:12 +00:00
oleibman 1bb962c76b Merge branch 'master' into pdfhdrtlr 2026-01-27 18:17:04 -08:00
oleibman 12095e5f49 Merge pull request #4790 from PHPOffice/dependabot/composer/phpunit/phpunit-10.5.62
Bump phpunit/phpunit from 10.5.60 to 10.5.62
2026-01-28 02:11:14 +00:00
dependabot[bot] 662e0a943a Bump phpunit/phpunit from 10.5.60 to 10.5.62
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.60 to 10.5.62.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.5.62/ChangeLog-10.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.5.60...10.5.62)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-version: 10.5.62
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-28 01:32:46 +00:00
oleibman 15fbc9a9d9 Headers and Footers in Pdf
Fix #3159, at least as far as we can. Requester would probably prefer that we automatically translate the PhpSpreadsheet header and footer information to forms that the Pdf vendors can handle. That seems like it would be very difficult. On the other hand, we can add some new properties to the Pdf writers to make it *relatively* easy for the user to define their own headers and footers for the writers.

Mpdf, as mentioned in the issue, can already handle this in conjunction with the `editHtmlCallback` property. This is demonstraded in Sample21c, which is now renamed to something more descriptive, `Mpdf_Custom_Headers`. That is the only change needed for Mpdf.

Tcpdf, which currently automatically prevents any footers or headers, needs some new properties to allow them. Even with the new properties, a user would need to extend both PhpSpreadsheet's Tcpdf Writer, and the vendor's own class (extending that class is actually the vendor's recommendation). A new sample `Tcpdf_Custom_Headers` demonstrates how this would be done.

Dompdf has 2 ways to add headers and footers. One is pretty good at styling, but doesn't offer much flexibility for dynamic properties other than the current page number; it can't handle different odd/even/first headers, nor the number of pages in the document. The second makes the dynamic properties possible, but seems difficult to style. Two new samples `Dompdf_Custom_Headers` (using `editHtmlCallback`) and `Dompdf_Canvas_Headers` (using a new protected method `callPageScript`) illustrate the use of each.

None of the samples demonstrates the full capabilities of what can go into a header or footer. I consider that out of scope; enabling the ability is one thing, perfecting it is quite another.
2026-01-26 21:08:46 -08:00
oleibman 12861f44e2 Merge pull request #4787 from oleibman/issue1810
Option To Use OldCalculatedValue in ToArray and its Relatives
2026-01-24 03:59:49 +00:00
oleibman c735e2fc82 Use Cell Value if OldCalculatedValue is Null 2026-01-23 18:15:41 -08:00
oleibman 7aef8b24cc Option To Use OldCalculatedValue in ToArray and its Relatives
Fix #1810, just before it turns 6 years old. Reporter thinks it can save time. Easy to implement, especially with the advent of named parameters which were not available when issue was opened.
2026-01-23 14:56:16 -08:00
oleibman 7758d917ba Merge pull request #4657 from oleibman/issue4656
Handling Unions as Function Arguments
2026-01-22 00:01:43 +00:00
oleibman 51d72ad1e9 Merge branch 'master' into issue4656 2026-01-21 13:20:03 -08:00
oleibman 3852e81bb5 Update CHANGELOG.md 2026-01-21 12:45:09 -08:00