AutoNumFieldOpts.vb
C# VB
'''' This code is part of Document Solutions for Word demos.'' Copyright (c) MESCIUS inc. All rights reserved.''Imports System.GlobalizationImports GrapeCity.Documents.WordImports GrapeCity.Documents.Word.Fields
'' This sample shows how to add an AUTONUM (Automatic Numbering) field to a Word document,'' and specify its options.Public Class AutoNumFieldOpts Function CreateDocx() As GcWordDocument Dim doc = New GcWordDocument()
Dim options = New AutoNumFieldOptions(doc)
Dim p As Paragraph = doc.Body.AddParagraph("Heading 1", doc.Styles(BuiltInStyleId.Heading1)) p.GetRange().ComplexFields.Insert(options, InsertLocation.Start)
p = doc.Body.AddParagraph("Heading 2", doc.Styles(BuiltInStyleId.Heading2)) p.GetRange().ComplexFields.Insert(options, InsertLocation.Start)
p = doc.Body.AddParagraph("Heading 2", doc.Styles(BuiltInStyleId.Heading2)) p.GetRange().ComplexFields.Insert(options, InsertLocation.Start)
p = doc.Body.AddParagraph("Heading 3", doc.Styles(BuiltInStyleId.Heading3)) p.GetRange().ComplexFields.Insert(options, InsertLocation.Start)
p = doc.Body.AddParagraph("Heading 3", doc.Styles(BuiltInStyleId.Heading3)) p.GetRange().ComplexFields.Insert(options, InsertLocation.Start)
p = doc.Body.AddParagraph("Heading 1", doc.Styles(BuiltInStyleId.Heading1)) p.GetRange().ComplexFields.Insert(options, InsertLocation.Start)
p = doc.Body.AddParagraph("Heading 2", doc.Styles(BuiltInStyleId.Heading2)) p.GetRange().ComplexFields.Insert(options, InsertLocation.Start)
doc.UpdateFields(New GrapeCity.Documents.Word.Layout.WordLayoutSettings() With { .FontCollection = Util.FontCollection, .Culture = CultureInfo.GetCultureInfo("en-US") })
Return doc End FunctionEnd Class