Expand Minimize

DocumentBase.Lists Property

Gets a Lists collection that contains all the formatted lists 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 Lists Lists { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Lists
A Lists collection that contains all the formatted lists in the document.

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

private void DocumentLists()

    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);
    object index = 1;

    Word.ListTemplate myTemplate = Application.ListGalleries[Microsoft.Office.Interop.Word.WdListGalleryType.wdNumberGallery].ListTemplates.get_Item(ref index);

        ref missing, ref missing, ref missing);

    MessageBox.Show ("Total lists in document: " +


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