'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''ImportsSystem.IOImportsSystem.GlobalizationImportsGrapeCity.Documents.Word '' This sample is similar to DataTplSimpleList'' but uses a JSON data source to generate'' the list of ocean seas.PublicClassDataTplSimpleListJsonFunctionCreateDocx() AsGcWordDocumentDim doc = NewGcWordDocument() '' The JSON data source is loaded from oceans.json:Using oceans = File.OpenRead(Path.Combine("Resources", "data", "oceans.json")) doc.DataTemplate.DataSources.Add("ds", oceans)EndUsing '' Add a list template so that the data is formatted as a list:Dim myListTemplate = doc.ListTemplates.Add(BuiltInListTemplateId.BulletDefault, "myListTemplate") '' The single paragraph added to the document contains template tags:'' - {{#ds}}..{{/ds}} -- root template, 'ds' is the name of the data source;'' - {ds.seas.name} -- fetches the sea name;'' - :toupper() -- uppercases the data:Dim p = doc.Body.Paragraphs.Add("{{#ds}}{{ds.seas.name}:toupper()}{{/ds}}", doc.Styles(BuiltInStyleId.ListParagraph)) p.ListFormat.Template = myListTemplate '' This call expands all data templates in the document,'' replacing template tags with data (iterating over all data items): doc.DataTemplate.Process(CultureInfo.GetCultureInfo("en-US")) '' Done:Return docEndFunctionEndClass