'''' 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'' pbb (paragraph-block-behavior) template formatter'' should start and end in the same cell error.PublicClassDataTplFixPbbNotInTable'' 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: a range with a pbb (paragraph-block-behavior) formatter is defined'' outside of a table: doc.Body.Paragraphs.Add("{{#ds.seas}:pbb()}{{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: remove the pbb formatter as it is not needed outside of table: doc.Body.Paragraphs.Add("{{#ds.seas}}{{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) formatter " +$"was defined not inside a table. A pbb formatter can only be used inside a table cell.", doc.Styles(BuiltInStyleId.BlockText),InsertLocation.Start)EndTryReturn docEndFunctionEndClass