Commit Graph

6246 Commits

Author SHA1 Message Date
oleibman 8a033d05f0 Resolve Merge Conflicts 2026-04-06 22:30:37 -07:00
kemo dc4c094b7c Move benchmarks to tests/Benchmark to avoid running with unit tests 2026-03-16 15:01:04 +01:00
kemo 56aaa23e01 Ignore unreachable fwrite in leftover flush block 2026-03-11 13:33:08 +01:00
kemo 9bc796f057 Exclude benchmark from coverage and ignore defensive guards 2026-03-11 10:49:55 +01:00
kemo 22233731dc Mark unreachable fread guard with codeCoverageIgnore 2026-03-11 10:25:39 +01:00
kemo 29ff76fc3f Add coverage tests for streaming encoding edge cases 2026-03-11 09:38:06 +01:00
kemo 545cafb7f2 Add tests for listWorksheetNames and empty file coverage 2026-03-11 08:39:40 +01:00
kemo e0ecd38a82 Throw exception on fopen failure in streaming encoding 2026-03-11 07:31:28 +01:00
kemo 54a7d9f905 Fix phpstan and code style errors 2026-03-10 23:59:29 +01:00
kemo a418af938b Add benchmark test for CSV streaming encoding conversion 2026-03-10 15:23:20 +01:00
kemo 2a80fc2bad Stream encoding conversion in CSV reader to reduce peak memory 2026-03-10 15:07:09 +01:00
oleibman a1dacfdf79 Merge pull request #4820 from oleibman/literals
Consistent Usage of Column and Row Limits
2026-03-06 23:51:38 +00:00
oleibman 31cdce2a85 Merge pull request #4821 from oleibman/license2016
Update License
2026-03-05 06:21:21 +00:00
oleibman c5317b8643 Update License 2026-03-04 22:15:58 -08:00
oleibman 3570cf16d1 More Coverage 2026-03-04 11:02:14 -08:00
oleibman e2742d1e98 Merge pull request #4819 from oleibman/checkout
Actions/checkout@v6
2026-03-04 05:50:57 +00:00
oleibman 8fd5535fce Coverage Tweak 2026-03-03 20:42:27 -08:00
oleibman 40f7cd00db Consistent Usage of Column and Row Limits
We have identical constants defined in several places, and use literals in others. We aren't consistent in checking limits. This PR makes the use of the constants in Cell/AddressRange the "official" source, deprecates all other constants, and substitutes the constants wherever literals are used. A number of different edge case tests are added.

During testing, I discovered that `columnIndexFromString` correctly throws an exception for 4-character string, but allows `XFE` through `ZZZ`, all of which are also invalid. There are similar inconsistencies with related routines, and this PR attempts to make them operate consistently. One suprise is that throwing for `row=0` causes serious regression problems, so it continues to be permitted (but the high row limit is enforced).

Further, Reference Helper sometimes dips into negative numbers, resulting in totally unexpected results (-1 affects column Z, -2 column Y, etc.). It is changed to ignore rows and columns outside the limits.
2026-03-03 19:04:11 -08:00
oleibman 21ec537a39 Actions/checkout@v6
Just keeping the software which we use on Github current.
2026-03-02 16:58:22 -08:00
oleibman 3aa2b7c2d9 Merge pull request #4818 from PHPOffice/dependabot/composer/tecnickcom/tcpdf-6.11.0
Bump tecnickcom/tcpdf from 6.10.1 to 6.11.0
2026-03-01 15:06:10 +00:00
dependabot[bot] afd7019a60 Bump tecnickcom/tcpdf from 6.10.1 to 6.11.0
Bumps [tecnickcom/tcpdf](https://github.com/tecnickcom/TCPDF) from 6.10.1 to 6.11.0.
- [Changelog](https://github.com/tecnickcom/TCPDF/blob/main/CHANGELOG.TXT)
- [Commits](https://github.com/tecnickcom/TCPDF/compare/6.10.1...6.11.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-01 11:02:15 +00:00
oleibman eecd31b885 Merge pull request #4817 from oleibman/changelog20260228
Prepare Changelog for New Release
5.5.0
2026-03-01 00:58:56 +00:00
oleibman 8dd433eb2b Prepare Changelog for New Release
Dependabot day is tomorrow, so get a jump on that by upgrading composer.lock.

Phpstan newly flagged a method in Writer/Xls/Worksheet which is not used internally, and seems impossible to be used by user programs. Deprecate it and some associates. No code changes.
2026-02-28 11:45:12 -08:00
oleibman 7548be17d3 Merge pull request #4815 from oleibman/odsstyles4b
Ods Reader Style Support (Last) - Column Styles (Partial)
2026-02-27 20:04:06 +00:00
oleibman 6b7d2043b8 Use Named Constant Rather than Literal for Highest Column
I would like to have used `use const`, but couldn't find a way that satisfied all of phpcs, php-cs-fixer, and phpstan.
2026-02-25 09:55:35 -08:00
oleibman aa631c68ef Additional Test 2026-02-24 09:21:54 -08:00
oleibman 015afae320 Ods Reader Style Support (Last) - Column Styles (Partial)
Continuing the work of PR #4810 and PR #4813 and PR #4814. According to the spec for LibreOffice, the xml for both coluns and rows allow a `default-cell-style-name` attribute. However, my testing indicates that using that attribute with a row doesn't result in the results I would expect; furthermore, LibreOffice doesn't seem to use that attribute in association with a row (it does use it for columns). For rows, it fills the unpopulated rows in the cell with a repeated table cell with the appropriate style. These filler cells have been a source of problems for us, and I'm not willing to add them at this time (maybe in future). So, if a style is applied to a row in PhpSpreadsheet, it will be reflected in all cells in that row until `highestDataColumn`, but no further.

Since LibreOffice does support adding a style to a column both in the UI and the Xml, it should be a little easier. But its support is imcomplete as well - when reading a spreadsheet, the UI will apply the style only to the rows that are defined in the xml. Again, this requires filler rows for the rows beyond `highestDataRow`, and, again, I am not willing to add those. However, it is important to process the column style when reading because, unlike the case with rows, the cells which are defined in the column may omit style data altogether if the style matches the column style.

There has till now been no support for `ReadDataOnly` (default false) and `ReadEmptyCells` (default true) for Ods Reader. These are now added. ReadEmptyCells is especially important and it would be sensible to usually set it to false. The reason is that LibreOffice usually supplies a width for all the columns mentioned in its row fillers, and PhpSpreadsheet needs to create ColumnDimensions for each of those as a result, resulting in much larger xml than one would expect when the spreadsheet is saved. This arose when I was testing this change - it has always been the case, but nobody has raised an issue about it. We avoid this problem by ignoring the extra columns for ReadEmptyCells false. But this requires a little redundancy in the code. We need to define styles for an entire column before we define styles for the cells in the column, but we don't need to define column widths beforehand. So, if ReadEmptyCells is false, we need to process the columns for styles, then process the cell data (so that we know what `highDataColumn` is), then process the columns again but this time for widths (ignoring columns beyond highDataColumn). If ReadEmptyCells is true, we can process column styles and widths in a single pass.
2026-02-23 17:22:08 -08:00
oleibman 2920b2ae11 Merge pull request #4814 from oleibman/odsstyles3
Ods Reader Style Support Part 3 - Borders
2026-02-21 22:17:15 +00:00
oleibman 97aa5260d4 Ods Reader Style Support Part 3 - Borders
Continuing the work of PR #4810 and PR #4813. All "real" borders are implemented. Pseudo-borders (outline, vertical, horizontal, inside, and allBorders) are not because I'm not really sure how, or even if, Ods handles them. However, Sample20_Read_Ods demonstrates a way to emulate `outline` using just the real borders. In template OOCalcTest.ods cells B18:C19 are merged, and the merged cell has multi-colored borders, something which `outline` isn't able to do. Ods Reader handles this by assigning the border style first to cell B18 (which is what Ods wants, and it doesn't hurt Xlsx/Xls) and then to cells B18:C19 (which is what Xlsx and Xls want, and it doesn't hurt Ods).

Ods Reader changes still to come
- Style applied to entire row
- Style applied to entire column
- Parent styles?

Ods Writer changes still to come
- Style applied to entire row
- Style applied to entire column
- Parent styles?

Not currently on my to-do list
- Pseudo-borders
- Subscript and superscript fonts (these really only make sense for RichText, and I'm not sure how Ods handles RichText)
- Default border, alignment, and protection. I'm not convinced there's a use case. Ods handles its defaults in two different manners, and I don't want to spend the time trying to understand it without justification.
2026-02-19 17:54:39 -08:00
oleibman d7b4442307 Merge pull request #4813 from oleibman/odsstyles2
Ods Reader Style Support Part 2 - Alignment, Protection, Default Fill
2026-02-19 00:58:56 +00:00
oleibman 62628e0336 Additional Test 2026-02-18 10:29:49 -08:00
oleibman 5003a13bf6 Update Feature Cross-Reference 2026-02-18 09:18:19 -08:00
oleibman 3072ee7593 Coverage Tweak 2026-02-18 01:38:07 -08:00
oleibman 0c64e18cbd Ods Reader Style Support Part 2 - Alignment, Protection, Default Fill
Continuing the work of PR #4810.

Ods Reader changes still to come
- Default border, alignment, protection
- Font
    - subscript
    - superscript
- Borders (up next)
- Style applied to entire row
- Style applied to entire column
- Parent styles?

Ods Writer changes still to come
- Default border, alignment, protections
- Style applied to entire row
- Style applied to entire column
- Parent styles?
2026-02-18 00:56:28 -08:00
oleibman d9cd9acf9c Merge pull request #4810 from oleibman/odsstyles
Ods Reader Style Support Part 1 - Fonts and Solid Fill
2026-02-16 19:59:08 +00:00
oleibman 6ee98a89a8 Additional Test 2026-02-16 02:18:14 -08:00
oleibman 5f460e6ba7 Some Corrections
Sample 20_Read_Ods exposed some problems which are now corrected.
2026-02-16 01:19:26 -08:00
oleibman 14513b63b5 Doc Update 2026-02-15 01:09:37 -08:00
oleibman 97f63c801f Edge Case
If no `style:default-style` with `text-properties`, use style `Default` with `text-properties` for default.
2026-02-14 23:19:35 -08:00
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