Skip to content

Conversation

@rasamassen
Copy link

@rasamassen rasamassen commented Sep 9, 2025

Add missing features in Paragraph and fix issues with existing features.

Description

  • Adds widowControl, keepNext, keepLines, contextualSpacing, and suppressAutoHyphens
  • Fixes hasPageBreakBefore() triggering wrong RTF tag (was using \page, should be using \pagebb).
  • Fixes alignment to use SimpleType::Jc exclusively and adds missing alignments
  • Fixes bidi to include the \rtlpar direction control

Unsolved Issues

  • Widow/Orphan control is default "off" in RTF (even if it wasn't set in \RTF\Part\Document.php, as it currently is), but is default "on" in most modern document programs (Microsoft Word, Google Docs, etc.). In Paragraph, Widow/Orphan control is default "on", which means every paragraph has to manually override the document level setting. Unfortunately, there's currently no way to check the Widow/Orphan settings of the entire document (there's nothing in Settings), but it would be simpler output if there was a Document-level setting that could be checked, and only print the opposite setting if set at the document level. The way things are works, but it's less than ideal setting this variable every paragraph.

Fixes

#344

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

@coveralls
Copy link

coveralls commented Sep 9, 2025

Coverage Status

coverage: 96.78% (+0.02%) from 96.757%
when pulling 6839c02 on rasamassen:paragraph
into 0ab0b49 on PHPOffice:master.

@rasamassen rasamassen changed the title RTF Writer: Add Pagination to Paragraph RTF Writer: Add Missing Features to Paragraph Oct 4, 2025
@rasamassen rasamassen changed the title RTF Writer: Add Missing Features to Paragraph RTF Writer: Paragraph - Add Missing Features Oct 4, 2025
oleibman added a commit to oleibman/PHPWord that referenced this pull request Nov 21, 2025
I made RTF usable some time ago. @rasamassen has recently done a lot of useful work to cover many missing areas. Since who knows when those changes will be merged, I intend to incorporate much of that work. I will do this with several pushes, each based on one or more of those changes. This one is based on PR PHPOffice#2824 (fixes issue PHPOffice#344), and PR PHPOffice#2826. Widow-orphan control may be affected by this change; based on comments in 2824, I have added a document-level widow-control used only by Rtf, but do not, as yet, use that value to do anything other than read/write an appropriate instruction in the file header.
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