//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.Globalization;usingGrapeCity.Documents.Word;usingGrapeCity.Documents.Word.Fields; namespaceDsWordWeb.Demos{// This sample shows how to add a LISTNUM (List Number) field to a Word document,// and specify its options.publicclassListNumFieldOpts {publicGcWordDocumentCreateDocx() {GcWordDocument doc = new(); // Create a new list template:string listName = "MyList";_ = doc.ListTemplates.Add(BuiltInListTemplateId.OutlineLegal, listName); // Create options for LISTNUM fields:ListNumFieldOptions options = new(doc) {Name = listName,Level = 1 }; // Create a table:Table table = doc.Body.AddTable( [ ["Step" , "Description"] , [null, "Open the Settings menu."], [null, "Select \"Preferences\" from the list."], [null, "Click \"Save\" to apply changes."], ], doc.Styles[BuiltInStyleId.GridTable1Light]); // Header style: table.Format.StyleOptions |= TableStyleOptions.FirstRow; // including LISTNUM fields in the left column table[1, 0].GetRange().Paragraphs.First.GetRange().ComplexFields.Add(options); table[2, 0].GetRange().Paragraphs.First.GetRange().ComplexFields.Add(options); table[3, 0].GetRange().Paragraphs.First.GetRange().ComplexFields.Add(options); // Update fields using a specific culture: doc.UpdateFields(newGrapeCity.Documents.Word.Layout.WordLayoutSettings() { FontCollection = Util.FontCollection, Culture = CultureInfo.GetCultureInfo("en-US") }); // Done:return doc; } }}