Uh oh!
There was an error while loading. Please reload this page.
Preserve spaces around template tags (#104) - #117
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the text assignment in MiniWord.Implment.cs to use the string representation of a StringBuilder and preserves whitespace formatting. The review feedback suggests caching the StringBuilder's string representation to avoid redundant allocations and improve performance.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Uh oh!
There was an error while loading. Please reload this page.
Fixes#104
Problem
Spaces between template tags (or between tags and words) were dropped in the generated document. E.g.
From {{a}} to {{b}}rendered asFrom 11-may-2025to 11-may-2026.Cause
In OOXML, leading/trailing whitespace in a
<w:t>element is stripped unless the element hasxml:space="preserve". Text elements created during tag replacement were missing this attribute (which is also why non-breaking spaces were unaffected, as noted in the issue).Fix
Set
Space = SpaceProcessingModeValues.Preserveon Text elements created during replacement.Testing
Reproduced the issue. After the fix, spaces are preserved correctly.