Skip to content

Conversation

rasamassen
Copy link

@rasamassen rasamassen commented Sep 4, 2025

Description

This is a first go at making ListItem work in RTF Writer. It's a start, but needs revisions.

Creates ListTable and ListOverrideTable in Header. Creates ListItem in Document.

What's not working:

  • not all NumberFormats are supports (if anyone knows how to translate NumberFormat into RTF page 31-34 of 1.9.1 spec, help appreciated).
  • fontStyle and paragraphStyle isn't working, both for the leveltext and the listitem (still figuring this out).

Limitations:

  • PhpOffice\PhpWord\Style\NumberingLevel currently only sets a font name and doesn't store a whole font style (color, size, highlight, etc). Numbering can be fully styled, but the ability isn't currently available in the Library. Not sure how much work it would take to rewrite that.

Checklist:

  • My CI is 🟢
  • I have covered by unit tests my new code (check build/coverage for coverage report)
  • I have updated the documentation to describe the changes
  • I have updated the changelog

Adds $listTable, getListTable(), writeListTable(), and registerListItem(). Also extends registerHeaderItem() to check if item is instanceof Numbering.

Most functions empty for now. Work forthcoming.

#NOTE: Changes registerFont() to registerHeader() and registerFontItem() to registerHeaderItem(). This will break pull request PHPOffice#2818, but is simply fixed.
For some reason in RTF, defining the tab, hanging, and firstLine in the listtable (which is part of the spec) does not transfer down to the list (at least not in Word365), so it must be defined in each listitem individually.
@rasamassen rasamassen changed the title List item RTF Writer: List item Sep 4, 2025
@rasamassen
Copy link
Author

The basics are working, but I could use some help on this to get it feature complete and error-free.

@coveralls
Copy link

coveralls commented Sep 4, 2025

Coverage Status

coverage: 96.648% (-0.1%) from 96.757%
when pulling 19bc087 on rasamassen:listItem
into 0ab0b49 on PHPOffice:master.

@rasamassen rasamassen mentioned this pull request Sep 5, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants