Fix whitespace handling in UnicodeMapper and DocumentAssembler#183
Merged
stesee merged 3 commits intoCodeuctivity:mainfrom Jan 22, 2026
Merged
Fix whitespace handling in UnicodeMapper and DocumentAssembler#183stesee merged 3 commits intoCodeuctivity:mainfrom
stesee merged 3 commits intoCodeuctivity:mainfrom
Conversation
stesee
approved these changes
Jan 22, 2026
Collaborator
|
The test suite found an issue. |
Author
|
Uh oh, lemme have a look and figure that out... |
Author
|
Test suite should pass now, it was a case sensitivity issue with test file names |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR fixes how OpenXmlPowerTools handles whitespace in DOCX files, modifying it to match Microsoft Word's behavior, including proper support for the xml:space="preserve" attribute.
Problem
Previously, UnicodeMapper.RunToString() would directly concatenate text from <w:t> elements without honoring the xml:space="preserve" attribute or normalizing whitespace the way Word does. This caused:
Changes
UnicodeMapper.cs:
DocumentAssembler.cs:
Testing:
Impact
This fix ensures that higher-level features (OpenXmlRegex, DocumentAssembler, etc.) that rely on RunToString() now see the same text that end-users see and edit in Word, making text processing and content assembly more reliable and predictable.