Udostępnij za pośrednictwem


Document.ListParagraphs Property (2007 System)

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

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

Syntax

'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property ListParagraphs As ListParagraphs
'Usage
Dim instance As Document 
Dim value As ListParagraphs 

value = instance.ListParagraphs
[BrowsableAttribute(false)]
public ListParagraphs ListParagraphs { get; }
[BrowsableAttribute(false)]
public:
property ListParagraphs^ ListParagraphs {
    ListParagraphs^ get ();
}
public function get ListParagraphs () : ListParagraphs

Property Value

Type: ListParagraphs
A ListParagraphs collection that represents all the numbered paragraphs in the document.

Examples

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.

This example is for a document-level customization.

Private Sub DocumentListParagraphs()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.InsertParagraphAfter()

    Me.Paragraphs(1).Range.Text = "This is the first paragraph." 
    Me.Paragraphs(2).Range.Text = "This is the second paragraph." 

    Dim Start As Object = Me.Paragraphs(1).Range.Start
    Dim [End] As Object = Me.Paragraphs(2).Range.End 
    Dim myRange As Word.Range = Me.Range(Start, [End])

    myRange.ListFormat.ApplyNumberDefault()
    MessageBox.Show("Total numbered paragraphs: " & Me.ListParagraphs.Count)
End Sub
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);

}

.NET Framework Security

See Also

Reference

Document Class

Document Members

Microsoft.Office.Tools.Word Namespace