Repository navigation
fix: copy modern comments and their authors when extracting slides - #567
Merged
sergey-tihon merged 1 commit intoNov 30, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the changes preserving modern PowerPoint comments during slide extraction.
No open issues 🎉
What changed in this PR
This PR updates Clippit’s presentation builder to preserve modern PowerPoint comments when extracting slides, preventing dangling comment relationships and loss of comment text, replies, and author data.
Changes:
- Copies modern comment parts and updates slide relationships to reference them.
- Copies referenced authors without duplicate IDs and adds namespace constants for modern comments.
- Adds a regression test covering output validation, comment relationships, text, replies, and authors.
| File | Description |
|---|---|
Clippit/PtOpenXmlUtil.cs |
Adds namespace and element constants for modern PowerPoint comments. |
Clippit/PowerPoint/Fluent/FluentPresentationBuilder.Copy.cs |
Copies modern comment parts, their relationships, and referenced authors. |
Clippit.Tests/PowerPoint/PresentationBuilderTests.cs |
Tests preservation of modern comments, replies, authors, and valid relationships during slide extraction. |
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.
Problem
PresentationBuildercopies legacy comments (ppt/comments/comment*.xml) but not modern comments (PowerPoint 2018+ threaded comments).A slide with a modern comment holds a reference in its extension list:
The builder copies this element with the slide XML, but it does not copy the comment part (
ppt/comments/modernComment_*.xml) or the relationship. The output slide then has anr:idthat points to a relationship that does not exist.RelationshipValidatorreports it:The comment text and the authors are lost.
Fix
FluentPresentationBuilder.Copy.cs:CopyRelatedPartsForContentPartsnow handlesp188:commentRel. The newCopyModernCommentPartadds aPowerPointCommentPartto the new slide, copies the comment XML, sets ther:idto the new relationship, and callsPBT.AddRelationshipsfor relationships inside the comment part.CopyModernCommentAuthorscopies the authors that the comment part refers to intoppt/authors.xmlof the new presentation. It creates the authors part when it is missing and does not add an author two times.PtOpenXmlUtil.cs: newP188class with the names of thehttp://schemas.microsoft.com/office/powerpoint/2018/8/mainnamespace.Test
PB013_SlideWithModernCommentextracts the commented slide from the newTestFiles/PB013-ModernComment.pptxand checks that:Validate(schema and relationships),p188:commentRelpoints to the copied comment part,dotnet csharpier check .is clean.Notes
pc:sldMk sldId="...") keep the slide id of the source deck. PowerPoint resolves the comment in the output with the old id and with the new id, so this change does not rewrite it.<p:ext uri="{5BB2D875-25FF-4072-B9AC-8F64D62656EB}">in the commentextLst.OpenXmlValidator(Microsoft365) reports "The 'uri' attribute is not declared" for this element in the source file too. The copy does not add or change it.