From bd6e4b0b21d3484b7f9c52f8c5b133c22009f0ab Mon Sep 17 00:00:00 2001 From: mark-sil Date: Wed, 22 May 2024 12:24:28 -0400 Subject: [PATCH 1/3] Pass a content fragment to AddLexReferences() Converting the fragment to a string was resulting in the loss of all styling for Word Export. Now we pass the content fragment to AddLexReferences() and let the xhtml and json generators do the conversion to a string. Change-Id: I0574ae94317c1580894e944429432ea4d56c99c6 --- Src/xWorks/ConfiguredLcmGenerator.cs | 26 +++++++++++++++----------- Src/xWorks/ILcmContentGenerator.cs | 2 +- Src/xWorks/LcmJsonGenerator.cs | 4 ++-- Src/xWorks/LcmWordGenerator.cs | 4 ++-- Src/xWorks/LcmXhtmlGenerator.cs | 4 ++-- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/Src/xWorks/ConfiguredLcmGenerator.cs b/Src/xWorks/ConfiguredLcmGenerator.cs index 7ec0d6d567..1802ef5892 100644 --- a/Src/xWorks/ConfiguredLcmGenerator.cs +++ b/Src/xWorks/ConfiguredLcmGenerator.cs @@ -149,10 +149,10 @@ internal static StringBuilder GenerateLetterHeaderIfNeeded(ICmObject entry, } /// - /// This method uses a ThreadPool to execute the given individualActions in parallel. - /// It waits for all the individualActions to complete and then returns. - /// - internal static void SpawnEntryGenerationThreadsAndWait(List individualActions, IThreadedProgress progress) + /// This method uses a ThreadPool to execute the given individualActions in parallel. + /// It waits for all the individualActions to complete and then returns. + /// + internal static void SpawnEntryGenerationThreadsAndWait(List individualActions, IThreadedProgress progress) { var actionCount = individualActions.Count; //Note that our COM classes all implement the STA threading model, while the ThreadPool always uses MTA model threads. @@ -1580,29 +1580,33 @@ private static void GenerateContentForLexEntryRefsByType(ConfigurableDictionaryN // Generate XHTML by Type foreach (var typeGuid in lexEntryTypesFiltered) { - var innerBldr = new StringBuilder(); + var combinedContent = settings.ContentGenerator.CreateFragment(); bool first = true; foreach (var lexEntRef in lerCollection) { if (isComplex ? lexEntRef.ComplexEntryTypesRS.Any(t => t.Guid == typeGuid) : lexEntRef.VariantEntryTypesRS.Any(t => t.Guid == typeGuid)) { - innerBldr.Append(GenerateCollectionItemContent(config, pubDecorator, lexEntRef, collectionOwner, settings, first, typeNode)); - first = false; + var content = GenerateCollectionItemContent(config, pubDecorator, lexEntRef, collectionOwner, settings, first, typeNode); + if (!content.IsNullOrEmpty()) + { + combinedContent.Append(content); + first = false; + } } } - if (innerBldr.Length > 0) + if (!first) { var lexEntryType = lexEntryTypes.First(t => t.Guid.Equals(typeGuid)); - // Display the Type iff there were refs of this Type (and we are factoring) + // Display the Type if there were refs of this Type (and we are factoring) var generateLexType = typeNode != null; var lexTypeContent = generateLexType ? GenerateCollectionItemContent(typeNode, pubDecorator, lexEntryType, - lexEntryType.Owner, settings, first) + lexEntryType.Owner, settings, false) : null; var className = generateLexType ? settings.StylesGenerator.AddStyles(typeNode).Trim('.') : null; var refsByType = settings.ContentGenerator.AddLexReferences(generateLexType, - lexTypeContent, config, className, innerBldr.ToString(), IsTypeBeforeForm(config)); + lexTypeContent, config, className, combinedContent, IsTypeBeforeForm(config)); bldr.Append(refsByType); } } diff --git a/Src/xWorks/ILcmContentGenerator.cs b/Src/xWorks/ILcmContentGenerator.cs index 19e045ee81..4b25c6c1d9 100644 --- a/Src/xWorks/ILcmContentGenerator.cs +++ b/Src/xWorks/ILcmContentGenerator.cs @@ -58,7 +58,7 @@ IFragment GenerateGroupingNode(object field, string className, ConfigurableDicti IFragment AddImage(string classAttribute, string srcAttribute, string pictureGuid); IFragment AddImageCaption(string captionContent); IFragment GenerateSenseNumber(string formattedSenseNumber, string senseNumberWs, ConfigurableDictionaryNode config); - IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent, ConfigurableDictionaryNode config, string className, string referencesContent, bool typeBefore); + IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent, ConfigurableDictionaryNode config, string className, IFragment referencesContent, bool typeBefore); void BeginCrossReference(IFragmentWriter writer, bool isBlockProperty, string className); void EndCrossReference(IFragmentWriter writer); IFragment WriteProcessedSenses(bool isBlock, IFragment senseContent, ConfigurableDictionaryNode config, string className, IFragment sharedCollectionInfo); diff --git a/Src/xWorks/LcmJsonGenerator.cs b/Src/xWorks/LcmJsonGenerator.cs index 232c83a413..d4dcc2ca2f 100644 --- a/Src/xWorks/LcmJsonGenerator.cs +++ b/Src/xWorks/LcmJsonGenerator.cs @@ -364,7 +364,7 @@ public IFragment GenerateSenseNumber(string formattedSenseNumber, string wsId, C } public IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent, ConfigurableDictionaryNode config, string className, - string referencesContent, bool typeBefore) + IFragment referencesContent, bool typeBefore) { var bldr = new StringBuilder(); var fragment = new StringFragment(bldr); @@ -382,7 +382,7 @@ public IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent // Write an array with the references. xw.WritePropertyName("references"); xw.WriteStartArray(); - xw.WriteRaw(referencesContent); + xw.WriteRaw(referencesContent.ToString()); xw.WriteEndArray(); // Write properties related to the factored type (if any and if after). if (generateLexType && !typeBefore) diff --git a/Src/xWorks/LcmWordGenerator.cs b/Src/xWorks/LcmWordGenerator.cs index 3f863d877b..df513bb308 100644 --- a/Src/xWorks/LcmWordGenerator.cs +++ b/Src/xWorks/LcmWordGenerator.cs @@ -1381,7 +1381,7 @@ public IFragment GenerateSenseNumber(string formattedSenseNumber, string senseNu senseNum.AddStyleLink(WordStylesGenerator.SenseNumberStyleName, senseConfigNode, ConfigurableDictionaryNode.StyleTypes.Character); return senseNum; } - public IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent, ConfigurableDictionaryNode config, string className, string referencesContent, bool typeBefore) + public IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent, ConfigurableDictionaryNode config, string className, IFragment referencesContent, bool typeBefore) { var fragment = new DocFragment(); // Generate the factored ref types element (if before). @@ -1390,7 +1390,7 @@ public IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent fragment.Append(WriteProcessedObject(false, lexTypeContent, config, className)); } // Then add all the contents for the LexReferences (e.g. headwords) - fragment.Append(new DocFragment(referencesContent)); + fragment.Append(referencesContent); // Generate the factored ref types element (if after). if (generateLexType && !typeBefore) { diff --git a/Src/xWorks/LcmXhtmlGenerator.cs b/Src/xWorks/LcmXhtmlGenerator.cs index de97d90c9d..12930565b8 100644 --- a/Src/xWorks/LcmXhtmlGenerator.cs +++ b/Src/xWorks/LcmXhtmlGenerator.cs @@ -961,7 +961,7 @@ public IFragment GenerateSenseNumber(string formattedSenseNumber, string senseNu } public IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent, ConfigurableDictionaryNode config, string className, - string referencesContent, bool typeBefore) + IFragment referencesContent, bool typeBefore) { var bldr = new StringBuilder(100); var fragment = new StringFragment(bldr); @@ -971,7 +971,7 @@ public IFragment AddLexReferences(bool generateLexType, IFragment lexTypeContent bldr.Append(WriteProcessedObject(false, lexTypeContent, config, className)); } // Then add all the contents for the LexReferences (e.g. headwords) - bldr.Append(referencesContent); + bldr.Append(referencesContent.ToString()); // Generate the factored ref types element (if after). if (generateLexType && !typeBefore) { From 75fe1c4d51bd96b60276048e8609e45fd477fe89 Mon Sep 17 00:00:00 2001 From: mark-sil Date: Thu, 23 May 2024 11:19:25 -0400 Subject: [PATCH 2/3] Pass a fragment to AddLexReferences and AddCollection Converting the fragment to a string was resulting in the loss of all styling for Word Export. Now we pass the content fragment to both AddLexReferences() and AddCollection(). The xhtml and json generators do the conversion to a string. Change-Id: I6979ba8b706fae29a4d99ac980e7d8396038c181 --- Src/xWorks/ConfiguredLcmGenerator.cs | 54 ++++++++++++++-------------- Src/xWorks/ILcmContentGenerator.cs | 2 +- Src/xWorks/LcmJsonGenerator.cs | 4 +-- Src/xWorks/LcmWordGenerator.cs | 12 ++----- Src/xWorks/LcmXhtmlGenerator.cs | 4 +-- 5 files changed, 35 insertions(+), 41 deletions(-) diff --git a/Src/xWorks/ConfiguredLcmGenerator.cs b/Src/xWorks/ConfiguredLcmGenerator.cs index 1802ef5892..6d31f7ee34 100644 --- a/Src/xWorks/ConfiguredLcmGenerator.cs +++ b/Src/xWorks/ConfiguredLcmGenerator.cs @@ -1366,7 +1366,7 @@ private static IFragment GenerateContentForCollection(object collectionField, Co { // To be used for things like shared grammatical info var sharedCollectionInfo = settings.ContentGenerator.CreateFragment(); - var bldr = settings.ContentGenerator.CreateFragment(); + var frag = settings.ContentGenerator.CreateFragment(); IEnumerable collection; if (collectionField is IEnumerable) { @@ -1384,7 +1384,7 @@ private static IFragment GenerateContentForCollection(object collectionField, Co if (config.DictionaryNodeOptions is DictionaryNodeSenseOptions) { - bldr.Append(GenerateContentForSenses(config, pubDecorator, settings, collection, info, ref sharedCollectionInfo)); + frag.Append(GenerateContentForSenses(config, pubDecorator, settings, collection, info, ref sharedCollectionInfo)); } else { @@ -1392,11 +1392,11 @@ private static IFragment GenerateContentForCollection(object collectionField, Co ConfigurableDictionaryNode lexEntryTypeNode; if (IsVariantEntryType(config, out lexEntryTypeNode)) { - bldr.Append(GenerateContentForEntryRefCollection(config, collection, cmOwner, pubDecorator, settings, lexEntryTypeNode, false)); + frag.Append(GenerateContentForEntryRefCollection(config, collection, cmOwner, pubDecorator, settings, lexEntryTypeNode, false)); } else if (IsComplexEntryType(config, out lexEntryTypeNode)) { - bldr.Append(GenerateContentForEntryRefCollection(config, collection, cmOwner, pubDecorator, settings, lexEntryTypeNode, true)); + frag.Append(GenerateContentForEntryRefCollection(config, collection, cmOwner, pubDecorator, settings, lexEntryTypeNode, true)); } else if (IsPrimaryEntryReference(config, out lexEntryTypeNode)) { @@ -1413,13 +1413,13 @@ private static IFragment GenerateContentForCollection(object collectionField, Co bool first = true; foreach (var entry in lerCollection.Where(item => !item.ComplexEntryTypesRS.Any() && !item.VariantEntryTypesRS.Any())) { - bldr.Append(GenerateCollectionItemContent(config, pubDecorator, entry, collectionOwner, settings, first, lexEntryTypeNode)); + frag.Append(GenerateCollectionItemContent(config, pubDecorator, entry, collectionOwner, settings, first, lexEntryTypeNode)); first = false; } // Display refs of each type - GenerateContentForLexEntryRefsByType(config, lerCollection, collectionOwner, pubDecorator, settings, bldr, lexEntryTypeNode, + GenerateContentForLexEntryRefsByType(config, lerCollection, collectionOwner, pubDecorator, settings, frag, lexEntryTypeNode, true); // complex - GenerateContentForLexEntryRefsByType(config, lerCollection, collectionOwner, pubDecorator, settings, bldr, lexEntryTypeNode, + GenerateContentForLexEntryRefsByType(config, lerCollection, collectionOwner, pubDecorator, settings, frag, lexEntryTypeNode, false); // variants } else @@ -1428,36 +1428,36 @@ private static IFragment GenerateContentForCollection(object collectionField, Co bool first = true; foreach (var item in lerCollection) { - bldr.Append(GenerateCollectionItemContent(config, pubDecorator, item, collectionOwner, settings, first)); + frag.Append(GenerateCollectionItemContent(config, pubDecorator, item, collectionOwner, settings, first)); first = false; } } } else if (config.FieldDescription.StartsWith("Subentries")) { - GenerateContentForSubentries(config, collection, cmOwner, pubDecorator, settings, bldr); + GenerateContentForSubentries(config, collection, cmOwner, pubDecorator, settings, frag); } else if (IsLexReferenceCollection(config)) { - GenerateContentForLexRefCollection(config, collection.Cast(), cmOwner, pubDecorator, settings, bldr); + GenerateContentForLexRefCollection(config, collection.Cast(), cmOwner, pubDecorator, settings, frag); } else { bool first = true; foreach (var item in collection) { - bldr.Append(GenerateCollectionItemContent(config, pubDecorator, item, collectionOwner, settings, first)); + frag.Append(GenerateCollectionItemContent(config, pubDecorator, item, collectionOwner, settings, first)); first = false; } } } - if (bldr.Length() > 0 || sharedCollectionInfo.Length() > 0) + if (frag.Length() > 0 || sharedCollectionInfo.Length() > 0) { var className = settings.StylesGenerator.AddStyles(config).Trim('.'); return config.DictionaryNodeOptions is DictionaryNodeSenseOptions ? - settings.ContentGenerator.WriteProcessedSenses(false, bldr, config, className, sharedCollectionInfo) : - settings.ContentGenerator.WriteProcessedCollection(false, bldr, config, className); + settings.ContentGenerator.WriteProcessedSenses(false, frag, config, className, sharedCollectionInfo) : + settings.ContentGenerator.WriteProcessedCollection(false, frag, config, className); } return settings.ContentGenerator.CreateFragment(); } @@ -1523,7 +1523,7 @@ private static bool IsPrimaryEntryReference(ConfigurableDictionaryNode config, o private static IFragment GenerateContentForEntryRefCollection(ConfigurableDictionaryNode config, IEnumerable collection, ICmObject collectionOwner, DictionaryPublicationDecorator pubDecorator, GeneratorSettings settings, ConfigurableDictionaryNode typeNode, bool isComplex) { - var bldr = settings.ContentGenerator.CreateFragment(); + var frag = settings.ContentGenerator.CreateFragment(); var lerCollection = collection.Cast().ToList(); // ComplexFormsNotSubentries is a filtered version of VisibleComplexFormBackRefs, so it doesn't have it's own VirtualOrdering. @@ -1543,11 +1543,11 @@ private static IFragment GenerateContentForEntryRefCollection(ConfigurableDictio bool first = true; foreach (var entry in lerCollection.Where(item => !item.ComplexEntryTypesRS.Any() && !item.VariantEntryTypesRS.Any())) { - bldr.Append(GenerateCollectionItemContent(config, pubDecorator, entry, collectionOwner, settings, first, typeNode)); + frag.Append(GenerateCollectionItemContent(config, pubDecorator, entry, collectionOwner, settings, first, typeNode)); first = false; } // Display refs of each type - GenerateContentForLexEntryRefsByType(config, lerCollection, collectionOwner, pubDecorator, settings, bldr, typeNode, isComplex); + GenerateContentForLexEntryRefsByType(config, lerCollection, collectionOwner, pubDecorator, settings, frag, typeNode, isComplex); } else { @@ -1555,11 +1555,11 @@ private static IFragment GenerateContentForEntryRefCollection(ConfigurableDictio bool first = true; foreach (var item in lerCollection) { - bldr.Append(GenerateCollectionItemContent(config, pubDecorator, item, collectionOwner, settings, first)); + frag.Append(GenerateCollectionItemContent(config, pubDecorator, item, collectionOwner, settings, first)); first = false; } } - return bldr; + return frag; } private static void GenerateContentForLexEntryRefsByType(ConfigurableDictionaryNode config, List lerCollection, object collectionOwner, DictionaryPublicationDecorator pubDecorator, @@ -1613,7 +1613,7 @@ private static void GenerateContentForLexEntryRefsByType(ConfigurableDictionaryN } private static void GenerateContentForSubentries(ConfigurableDictionaryNode config, IEnumerable collection, ICmObject collectionOwner, - DictionaryPublicationDecorator pubDecorator, GeneratorSettings settings, IFragment bldr) + DictionaryPublicationDecorator pubDecorator, GeneratorSettings settings, IFragment frag) { var listOptions = config.DictionaryNodeOptions as DictionaryNodeListOptions; var typeNode = config.ReferencedOrDirectChildren.FirstOrDefault(n => n.FieldDescription == LookupComplexEntryType); @@ -1631,7 +1631,7 @@ private static void GenerateContentForSubentries(ConfigurableDictionaryNode conf { if (subentries[i].Item1 == null || !subentries[i].Item1.ComplexEntryTypesRS.Any()) { - bldr.Append(GenerateCollectionItemContent(config, pubDecorator, subentries[i].Item2, collectionOwner, settings, first)); + frag.Append(GenerateCollectionItemContent(config, pubDecorator, subentries[i].Item2, collectionOwner, settings, first)); first = false; subentries.RemoveAt(i--); } @@ -1643,7 +1643,7 @@ private static void GenerateContentForSubentries(ConfigurableDictionaryNode conf { if (subentries[i].Item1.ComplexEntryTypesRS.Any(t => t.Guid == typeGuid)) { - bldr.Append(GenerateCollectionItemContent(config, pubDecorator, subentries[i].Item2, collectionOwner, settings, first)); + frag.Append(GenerateCollectionItemContent(config, pubDecorator, subentries[i].Item2, collectionOwner, settings, first)); first = false; subentries.RemoveAt(i--); } @@ -1656,7 +1656,7 @@ private static void GenerateContentForSubentries(ConfigurableDictionaryNode conf bool first = true; foreach (var item in collection) { - bldr.Append(GenerateCollectionItemContent(config, pubDecorator, item, collectionOwner, settings, first)); + frag.Append(GenerateCollectionItemContent(config, pubDecorator, item, collectionOwner, settings, first)); first = false; } } @@ -2104,19 +2104,19 @@ private static IFragment GenerateCrossReferenceChildren(ConfigurableDictionaryNo switch (child.FieldDescription) { case "ConfigTargets": - var contentBldr = new StringBuilder(); + var content = settings.ContentGenerator.CreateFragment(); foreach (var referenceListItem in referenceList) { var referenceItem = referenceListItem.Item2; var targetItem = referenceListItem.Item1; - contentBldr.Append(GenerateCollectionItemContent(child, publicationDecorator, targetItem, referenceItem, settings, first)); + content.Append(GenerateCollectionItemContent(child, publicationDecorator, targetItem, referenceItem, settings, first)); first = false; } - if (contentBldr.Length > 0) + if (!content.IsNullOrEmpty()) { // targets settings.ContentGenerator.AddCollection(xw, IsBlockProperty(child), - CssGenerator.GetClassAttributeForConfig(child), config, contentBldr.ToString()); + CssGenerator.GetClassAttributeForConfig(child), config, content); } break; case "OwnerType": diff --git a/Src/xWorks/ILcmContentGenerator.cs b/Src/xWorks/ILcmContentGenerator.cs index 4b25c6c1d9..186294e118 100644 --- a/Src/xWorks/ILcmContentGenerator.cs +++ b/Src/xWorks/ILcmContentGenerator.cs @@ -51,7 +51,7 @@ IFragment GenerateGroupingNode(object field, string className, ConfigurableDicti void StartEntry(IFragmentWriter writer, ConfigurableDictionaryNode config, string className, Guid entryGuid, int index, RecordClerk clerk); void AddEntryData(IFragmentWriter writer, List pieces); void EndEntry(IFragmentWriter writer); - void AddCollection(IFragmentWriter writer, bool isBlockProperty, string className, ConfigurableDictionaryNode config, string content); + void AddCollection(IFragmentWriter writer, bool isBlockProperty, string className, ConfigurableDictionaryNode config, IFragment content); void BeginObjectProperty(IFragmentWriter writer, bool isBlockProperty, string getCollectionItemClassAttribute); void EndObject(IFragmentWriter writer); void WriteProcessedContents(IFragmentWriter writer, IFragment contents); diff --git a/Src/xWorks/LcmJsonGenerator.cs b/Src/xWorks/LcmJsonGenerator.cs index d4dcc2ca2f..3821c6bfd9 100644 --- a/Src/xWorks/LcmJsonGenerator.cs +++ b/Src/xWorks/LcmJsonGenerator.cs @@ -292,11 +292,11 @@ public void EndEntry(IFragmentWriter xw) ((JsonFragmentWriter)xw).EndObject(); } - public void AddCollection(IFragmentWriter writer, bool isBlockProperty, string className, ConfigurableDictionaryNode config, string content) + public void AddCollection(IFragmentWriter writer, bool isBlockProperty, string className, ConfigurableDictionaryNode config, IFragment content) { ((JsonFragmentWriter)writer).InsertPropertyName(className); BeginArray(writer); - WriteProcessedContents(writer, new StringFragment(content)); + WriteProcessedContents(writer, content); EndArray(writer); } diff --git a/Src/xWorks/LcmWordGenerator.cs b/Src/xWorks/LcmWordGenerator.cs index df513bb308..4069a72072 100644 --- a/Src/xWorks/LcmWordGenerator.cs +++ b/Src/xWorks/LcmWordGenerator.cs @@ -1323,17 +1323,11 @@ public void EndEntry(IFragmentWriter writer) { return; } - public void AddCollection(IFragmentWriter writer, bool isBlockProperty, string className, ConfigurableDictionaryNode config, string content) + public void AddCollection(IFragmentWriter writer, bool isBlockProperty, string className, ConfigurableDictionaryNode config, IFragment content) { - var frag = ((WordFragmentWriter)writer).WordFragment; - if (isBlockProperty && (config.StyleType == ConfigurableDictionaryNode.StyleTypes.Paragraph)) - frag.AddStyleLink(config.Style, config, ConfigurableDictionaryNode.StyleTypes.Paragraph); - else if (!isBlockProperty) - frag.AddStyleLink(config.Style, config, ConfigurableDictionaryNode.StyleTypes.Character); - - if (!string.IsNullOrEmpty(content)) + if (!content.IsNullOrEmpty()) { - frag.Append(content); + ((WordFragmentWriter)writer).WordFragment.Append(content); } } public void BeginObjectProperty(IFragmentWriter writer, bool isBlockProperty, string getCollectionItemClassAttribute) diff --git a/Src/xWorks/LcmXhtmlGenerator.cs b/Src/xWorks/LcmXhtmlGenerator.cs index 12930565b8..097bcd7ca4 100644 --- a/Src/xWorks/LcmXhtmlGenerator.cs +++ b/Src/xWorks/LcmXhtmlGenerator.cs @@ -884,12 +884,12 @@ public void EndEntry(IFragmentWriter writer) } public void AddCollection(IFragmentWriter writer, bool isBlockProperty, - string className, ConfigurableDictionaryNode config, string content) + string className, ConfigurableDictionaryNode config, IFragment content) { var xw = ((XmlFragmentWriter)writer).Writer; xw.WriteStartElement(isBlockProperty ? "div" : "span"); xw.WriteAttributeString("class", className); - xw.WriteRaw(content); + xw.WriteRaw(content.ToString()); xw.WriteEndElement(); } From 088fd1b7efd8332a38decba1625665c22f706550 Mon Sep 17 00:00:00 2001 From: mark-sil Date: Tue, 28 May 2024 09:41:59 -0400 Subject: [PATCH 3/3] Pass a fragment to AddLexReferences and AddCollection Converting the fragment to a string was resulting in the loss of all styling for Word Export. Now we pass the content fragment to both AddLexReferences() and AddCollection(). The xhtml and json generators do the conversion to a string. Change-Id: I519b27009483c6898a2437d537ffefa5dcea6b32 --- Src/xWorks/LcmWordGenerator.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Src/xWorks/LcmWordGenerator.cs b/Src/xWorks/LcmWordGenerator.cs index 4069a72072..2e5367f0bf 100644 --- a/Src/xWorks/LcmWordGenerator.cs +++ b/Src/xWorks/LcmWordGenerator.cs @@ -1325,9 +1325,15 @@ public void EndEntry(IFragmentWriter writer) } public void AddCollection(IFragmentWriter writer, bool isBlockProperty, string className, ConfigurableDictionaryNode config, IFragment content) { + var frag = ((WordFragmentWriter)writer).WordFragment; + if (isBlockProperty && (config.StyleType == ConfigurableDictionaryNode.StyleTypes.Paragraph)) + frag.AddStyleLink(config.Style, config, ConfigurableDictionaryNode.StyleTypes.Paragraph); + else if (!isBlockProperty) + frag.AddStyleLink(config.Style, config, ConfigurableDictionaryNode.StyleTypes.Character); + if (!content.IsNullOrEmpty()) { - ((WordFragmentWriter)writer).WordFragment.Append(content); + frag.Append(content); } } public void BeginObjectProperty(IFragmentWriter writer, bool isBlockProperty, string getCollectionItemClassAttribute)