Expand Minimize

DocumentBase.ListParagraphs Property

Gets a ListParagraphs collection that represents all the numbered paragraphs in the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public ListParagraphs ListParagraphs { get; }

Property Value

Type: Microsoft.Office.Interop.Word.ListParagraphs
A ListParagraphs collection that represents all the numbered paragraphs in the document.

The following code example adds text to the first two paragraphs, applies numbering to the paragraphs, and then displays a message that shows the total number of paragraphs that are numbered. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentListParagraphs()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.InsertParagraphAfter();


    this.Paragraphs[1].Range.Text = "This is the first paragraph.";
    this.Paragraphs[2].Range.Text = "This is the second paragraph.";

    object Start = this.Paragraphs[1].Range.Start;
    object End = this.Paragraphs[2].Range.End;
    Word.Range myRange = this.Range(ref Start,
        ref End);

    myRange.ListFormat.ApplyNumberDefault(ref missing);
    MessageBox.Show("Total numbered paragraphs: " +
        this.ListParagraphs.Count);

}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft