From 8cd29518fd40c715ebc1674ab056b0319b6da3ef Mon Sep 17 00:00:00 2001 From: mark-sil <83427558+mark-sil@users.noreply.github.com> Date: Wed, 25 Mar 2026 12:14:01 -0400 Subject: [PATCH] LT-22456: Word Export: Fix spacing after lines We now always set the before and after spacing for a line, even if the value is zero. Word generates its own value if we do not set it. --- Src/xWorks/WordStylesGenerator.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Src/xWorks/WordStylesGenerator.cs b/Src/xWorks/WordStylesGenerator.cs index a3de5d4ada..0872ee1227 100644 --- a/Src/xWorks/WordStylesGenerator.cs +++ b/Src/xWorks/WordStylesGenerator.cs @@ -336,16 +336,15 @@ internal static Style GenerateWordStyleFromLcmStyleSheet(bool paragraphData, str parProps.Append(new SpacingBetweenLines() { Line = lineHeight.ToString(), LineRule = LineSpacingRuleValues.Exact }); } } - if (exportStyleInfo.HasSpaceAfter) - { - parProps.Append(new SpacingBetweenLines() { After = MilliPtToTwentiPt(exportStyleInfo.SpaceAfter).ToString() }); - } - if (exportStyleInfo.HasSpaceBefore) - { - parProps.Append(new SpacingBetweenLines() { Before = MilliPtToTwentiPt(exportStyleInfo.SpaceBefore).ToString() }); - } } + // Set the space before and after the line, even if the value is zero. If we do not set the value + // then Word generates a value, sometimes 8 or 24 point. + int spaceAfter = exportStyleInfo.HasSpaceAfter ? exportStyleInfo.SpaceAfter : 0; + int spaceBefore = exportStyleInfo.HasSpaceBefore ? exportStyleInfo.SpaceBefore : 0; + parProps.Append(new SpacingBetweenLines() { After = MilliPtToTwentiPt(spaceAfter).ToString() }); + parProps.Append(new SpacingBetweenLines() { Before = MilliPtToTwentiPt(spaceBefore).ToString() }); + if (exportStyleInfo.HasTrailingIndent) { parProps.Append(new Indentation() { Right = MilliPtToTwentiPt(exportStyleInfo.TrailingIndent).ToString() });