'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.GlobalizationImportsGrapeCity.Documents.Word '' This example shows how to deal with the template formatter'' conflicting with another formatter error.PublicClassDataTplFixFormatterConflict'' Code demonstrating the problem:PrivateFunctionProblem() AsGcWordDocumentUsing oceans = File.OpenRead(Path.Combine("Resources", "data", "oceans.json"))Dim doc = NewGcWordDocument() doc.DataTemplate.DataSources.Add("ds", oceans)'' Incorrect: pbb (paragraph-block-behavior) and rbb (run-block-behavior) formatters'' were both applied to the same range template tag: doc.Body.Paragraphs.Add("{{#ds.seas}:pbb():rbb()}{{ds.seas.name}} {{/ds.seas}}") doc.DataTemplate.Process(CultureInfo.GetCultureInfo("en-US"))Return docEndUsingEndFunction '' Code demonstrating the fix:PrivateFunctionFix() AsGcWordDocumentUsing oceans = File.OpenRead(Path.Combine("Resources", "data", "oceans.json"))Dim doc = NewGcWordDocument() doc.DataTemplate.DataSources.Add("ds", oceans)'' Correct: pbb and rbb are block-modifier formatters, so only one of them can be used on a single range template tag: doc.Body.Paragraphs.Add("{{#ds.seas}:rbb()}{{ds.seas.name}} {{/ds.seas}}") doc.DataTemplate.Process(CultureInfo.GetCultureInfo("en-US"))Return docEndUsingEndFunction FunctionCreateDocx() AsGcWordDocumentDim doc AsGcWordDocumentTry'' This fails: doc = Problem()Catch ex As Exception'' This works: doc = Fix()'' Insert a brief explanation of the problem and the fix into the generated document: doc.Body.Paragraphs.Insert($"The error ""{ex.Message}"" occurred because a pbb (paragraph-block-behavior) and a rbb (run-block-behavior) " +$"formatters were both applied to the same range template tag. pbb and rbb are block-modifier formatters, " +$"so only one of them can be used on a single range template tag.", doc.Styles(BuiltInStyleId.BlockText),InsertLocation.Start)EndTryReturn docEndFunctionEndClass