Skip to content

Comments

Ods Reader Style Support Part 1 - Fonts and Solid Fill#4810

Merged
oleibman merged 6 commits intoPHPOffice:masterfrom
oleibman:odsstyles
Feb 16, 2026
Merged

Ods Reader Style Support Part 1 - Fonts and Solid Fill#4810
oleibman merged 6 commits intoPHPOffice:masterfrom
oleibman:odsstyles

Conversation

@oleibman
Copy link
Collaborator

@oleibman oleibman commented Feb 15, 2026

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

Ods Reader changes still to come

  • Default fill, border, alignment, protection
  • Font
    • subscript
    • superscript
  • Fill
    • types other than Solid (seems unsupported in LibreOffice)
  • Alignment
  • Borders
  • Protection
  • Style applied to entire row
  • Style applied to entire column
  • Parent styles?
  • Old Calculated Value

Ods Writer changes still to come

  • Default fill, border, alignment, protections
  • Style applied to entire row
  • Style applied to entire column
  • Parent styles?

This is:

  • a bugfix
  • a new feature
  • refactoring
  • additional unit tests

Checklist:

  • Changes are covered by unit tests
    • Changes are covered by existing unit tests
    • New unit tests have been added
  • Code style is respected
  • Commit message explains why the change is made (see https://github.com/erlang/otp/wiki/Writing-good-commit-messages)
  • CHANGELOG.md contains a short summary of the change and a link to the pull request if applicable
  • Documentation is updated as necessary

Fix PHPOffice#2622. Fix PHPOffice#1191 (stale as of 2020 but just reopened). A long overdue addition. Ods Reader has till now not supported any styles (although PR PHPOffice#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 PHPOffice#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
If no `style:default-style` with `text-properties`, use style `Default` with `text-properties` for default.
Sample 20_Read_Ods exposed some problems which are now corrected.
@oleibman oleibman added this pull request to the merge queue Feb 16, 2026
Merged via the queue into PHPOffice:master with commit d9cd9ac Feb 16, 2026
15 checks passed
@oleibman oleibman deleted the odsstyles branch February 16, 2026 20:09
oleibman added a commit to oleibman/PhpSpreadsheet that referenced this pull request Feb 18, 2026
Continuing the work of PR PHPOffice#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?
oleibman added a commit to oleibman/PhpSpreadsheet that referenced this pull request Feb 20, 2026
Continuing the work of PR PHPOffice#4810 and PR PHPOffice#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant