Skip to content

Fix duplicated, misordered and truncated Word/Powerpoint snapshots#140

Merged
SimonCropp merged 4 commits into
mainfrom
Fix-duplicated,-misordered-and-truncated-Word/Powerpoint-snapshots
Jul 10, 2026
Merged

Fix duplicated, misordered and truncated Word/Powerpoint snapshots#140
SimonCropp merged 4 commits into
mainfrom
Fix-duplicated,-misordered-and-truncated-Word/Powerpoint-snapshots

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

RegisterFileConverter and RegisterStreamConverter(ext) were both pointed at the same Convert* method. Verify runs the extension stream converter over the package target a file converter returns, so verifying a typed document (WordprocessingDocument, SpreadsheetDocument, PresentationDocument) ran the whole extraction twice and wrote the info, the text and the rendered pages to two snapshot files each. A file converter now just hands over the cloned package and lets the extension converter own the extraction, so the typed and stream paths produce byte-identical output.

Three further bugs in the Word converter:

  • The document text was carried in WordInfo.Text and emitted as a txt target, putting it in two snapshots. It is now only the target. Same for PowerpointInfo.Text.
  • Document order was lost. The walk collected every paragraph then every table, and within a run every text then every tab then every break. It is now a single in-order walk.
  • Content controls were dropped, so all text inside a w:sdt vanished from the snapshot. SdtBlock, SdtRun, SdtRow and SdtCell are now transparent, matching what Word displays. Hyperlink runs were dropped too.

Adds Word tests for ordering, inline/block/in-cell content controls, hyperlinks and interleaved text and tabs. There was no w:sdt coverage, and sample.docx is two bare paragraphs, which is why none of this surfaced.

Snapshot churn across 15 tests is mostly filename shift rather than content: the duplicate #00/#1 pairs collapse to a single unsuffixed file.

RegisterFileConverter<T> and RegisterStreamConverter(ext) were both pointed
at the same Convert* method. Verify runs the extension stream converter over
the package target a file converter returns, so verifying a typed document
(WordprocessingDocument, SpreadsheetDocument, PresentationDocument) ran the
whole extraction twice and wrote the info, the text and the rendered pages to
two snapshot files each. A file converter now just hands over the cloned
package and lets the extension converter own the extraction, so the typed and
stream paths produce byte-identical output.

Three further bugs in the Word converter:

 * The document text was carried in WordInfo.Text and emitted as a txt target,
   putting it in two snapshots. It is now only the target. Same for
   PowerpointInfo.Text.
 * Document order was lost. The walk collected every paragraph then every
   table, and within a run every text then every tab then every break. It is
   now a single in-order walk.
 * Content controls were dropped, so all text inside a w:sdt vanished from the
   snapshot. SdtBlock, SdtRun, SdtRow and SdtCell are now transparent, matching
   what Word displays. Hyperlink runs were dropped too.

Adds Word tests for ordering, inline/block/in-cell content controls, hyperlinks
and interleaved text and tabs. There was no w:sdt coverage, and sample.docx is
two bare paragraphs, which is why none of this surfaced.

Snapshot churn across 15 tests is mostly filename shift rather than content:
the duplicate #00/#1 pairs collapse to a single unsuffixed file.
@SimonCropp SimonCropp added this to the 1.22.0 milestone Jul 9, 2026
@SimonCropp SimonCropp merged commit 496b66c into main Jul 10, 2026
3 of 4 checks passed
@SimonCropp SimonCropp deleted the Fix-duplicated,-misordered-and-truncated-Word/Powerpoint-snapshots branch July 10, 2026 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant