Udostępnij za pośrednictwem


DocumentBase.Sentences Property

Gets a Sentences collection that represents all the sentences 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)

Syntax

'Declaration
Public ReadOnly Property Sentences As Sentences
    Get
public Sentences Sentences { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Sentences
A Sentences collection that represents all the sentences in the document.

Examples

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

Private Sub DocumentSentences()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "This is sample text." & _
        " There are two sentences in this document."
    MessageBox.Show("Total sentences: " & Me.Sentences.Count.ToString())
End Sub 
private void DocumentSentences()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "This is sample text." +
        " There are two sentences in this document.";

    MessageBox.Show("Total sentences: " + 
        this.Sentences.Count.ToString());
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace