[]
GcWord allows you to specify paragraph numbering using the ListTemplate class which can be accessed using ListTemplates property of the DocumentBase class.
To get the paragraph numbering:
Access a paragraph from the paragraph collection using Paragraphs property of the RangeBase class.
Get the list formatting specified for the paragraph using ListFormat property of the Paragraph class.
Access list template of the paragraph using Template property of the ListFormat class.
Get the name of the list template using Name property of the ListTemplate class.
Display the paragraph numbering on the console.
//Get paragraph numbering
ParagraphCollection pars = doc.Body.Sections.First.GetRange().Paragraphs;
Console.WriteLine("Numbering template for the first paragraph: " +
pars[0].ListFormat.Template.Name);
To set the paragraph numbering:
Access the collection of list templates using ListTemplates property of the GcWordDocument class.
Add a new list template to the collection of list templates using Add method of the ListTemplateCollection class.
Access a paragraph from the paragraph collection using Paragraphs property of the RangeBase class.
Get the list formatting specified for the paragraph using ListFormat property of the Paragraph class.
Set list template of the paragraph using Template property of the ListFormat class.
//Set paragraph numbering
ParagraphCollection pars = doc.Body.Sections.First.GetRange().Paragraphs;
// A ListTemplate is used to assign ListFormat/numbering to paragraphs
ListTemplate myListTemplate = doc.ListTemplates.Add(
BuiltInListTemplateId.NumberArabicParenthesis, "myListTemplate");
//Set the ListFormat for the paragraphs
Paragraph p1 = pars[0];
p1.ListFormat.Template = myListTemplate;
Paragraph p2 = pars[1];
p2.ListFormat.Template = myListTemplate;
For more information on how to implement paragraph numbering using GcWord, see GcWord sample browser.