DsWord 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:
C# |
Copy Code |
---|---|
//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:
C# |
Copy Code |
---|---|
//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 DsWord, see DsWord sample browser.