Skip to content

Commit bfaad95

Browse files
committed
Fix handling handling whitespace between runs #195
1 parent 71ca1b7 commit bfaad95

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Html2OpenXml/Expressions/TextExpression.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public override IEnumerable<OpenXmlElement> Interpret (ParsingContext context)
8686
|| node.NextSibling!.TextContent[0].IsWhiteSpaceCharacter()
8787
))
8888
{
89-
return [new Run(new Text(" "))];
89+
return [new Run(new Text(" ") { Space = SpaceProcessingModeValues.Preserve })];
9090
}
9191
// we strip out all whitespaces and we stand inside a div. Just skip this text content
9292
if (text.Length == 0 && !preserveBorderSpaces)
@@ -124,7 +124,7 @@ public override IEnumerable<OpenXmlElement> Interpret (ParsingContext context)
124124
return [];
125125

126126
if (!context.PreserveLinebreaks)
127-
return [new Run(new Text(text))];
127+
return [new Run(new Text(text) { Space = SpaceProcessingModeValues.Preserve })];
128128

129129
Run run = EscapeNewlines(text);
130130
return [run];

0 commit comments

Comments
 (0)