From 540ff24a1af867d4bfc3a5ee220baab5bc0ab84c Mon Sep 17 00:00:00 2001 From: Mark Kidder <83427558+mark-sil@users.noreply.github.com> Date: Tue, 7 May 2024 15:38:47 -0400 Subject: [PATCH] LT-21778: Fix image textframe styles (#44) Fixed the problem with the continuation style being written to paragraphs containing images/captions (instead of the textframe style being written). Also, to prevent the problem with the paragraph following the image/caption from using the textframe style, we now base the continuation style on the first paragraph instead of the last. --- Src/xWorks/LcmWordGenerator.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Src/xWorks/LcmWordGenerator.cs b/Src/xWorks/LcmWordGenerator.cs index b3294152e0..395f033005 100644 --- a/Src/xWorks/LcmWordGenerator.cs +++ b/Src/xWorks/LcmWordGenerator.cs @@ -468,12 +468,12 @@ public void AppendToParagraph(IFragment fragToCopy, OpenXmlElement run, bool for if (forceNewParagraph) { // When forcing a new paragraph use a 'continuation' style for the new paragraph. - // The continuation style is based on the style used in the last paragraph. + // The continuation style is based on the style used in the first paragraph. string style = null; - WP.Paragraph lastParagraph = DocBody.OfType().LastOrDefault(); - if (lastParagraph != null) + WP.Paragraph firstParagraph = DocBody.OfType().FirstOrDefault(); + if (firstParagraph != null) { - WP.ParagraphProperties paraProps = lastParagraph.OfType().FirstOrDefault(); + WP.ParagraphProperties paraProps = firstParagraph.OfType().FirstOrDefault(); if (paraProps != null) { ParagraphStyleId styleId = paraProps.OfType().FirstOrDefault(); @@ -1206,14 +1206,16 @@ public void AddEntryData(IFragmentWriter writer, List