Repository navigation
fix(word): keep header and footer references when rejecting a section change - #550
Merged
sergey-tihon merged 1 commit intoOct 17, 2026
Conversation
… change RevisionProcessor.RejectRevisions replaced a w:sectPr that carries a w:sectPrChange with the recorded w:sectPr. The recorded properties are a CT_SectPrBase, which cannot hold w:headerReference or w:footerReference, so the section lost every header and footer. Word's Reject All restores the recorded properties and keeps the references. Build the rejected w:sectPr from the current references and the recorded properties, for body and paragraph-level sections alike.
This was referenced Oct 15, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The localized fix addresses the reported defect, with focused regression coverage and no unresolved findings.
No open issues 🎉
What changed in this PR
Fixes Word revision rejection so restoring recorded section properties preserves the section’s current header and footer references.
Changes:
- Retains header/footer references while restoring recorded properties.
- Adds accept/reject regression coverage for paragraph-level and final body sections.
| File | Description |
|---|---|
| Clippit/Word/RevisionProcessor.cs | Preserves references when rejecting section property changes. |
| Clippit.Tests/Word/RevisionProcessorTests.cs | Verifies references, margins, and valid output for both section locations. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rejecting a
w:sectPrChangemakes the section lose all its headers and footers.Reproduction. Two sections, each with a
w:headerReferenceandw:footerReference, each with<w:sectPrChange>recording the old margins. After Reject the sections readpgSz pgMar@1440 | pgSz pgMar@1440; Word restores the old margins and keeps the references:rIdHeader1 rIdFooter1 pgSz pgMar@1440 | rIdHeader2 rIdFooter2 pgSz pgMar@1440.Cause.
RejectRevisionsForPartTransformreplaces the wholew:sectPrwith the recorded one. The recorded properties areCT_SectPrBase, which cannot contain header or footer references, so they are lost.Fix. Build the rejected
w:sectPrfrom the current header/footer references followed by the recorded properties (an empty recordedw:sectPrno longer throws).Test.
RP055_SectionPropertiesChangeKeepsHeadersAndFooters(a section break inside a paragraph and the final body section).Found while using
RevisionProcessorto check that Reject All of a tracked-change redline gives back the original document. Expected results are Microsoft Word for Mac 16.113's own Accept All / Reject All on the same markup. The regression test fails on current master and passes with the fix;./build.shpasses.This is one of six small, independent
RevisionProcessorfixes (#548, #549, #550, #551, #552, #553). Each adds its test afterRP001inRevisionProcessorTests.cs, so whichever merges second will need a trivial rebase there; I'll rebase the rest as they land.Prepared with an AI coding agent (Claude); I reviewed the change and ran the tests.