Share via


DocumentBase.Sentences Property

Definition

Gets a Sentences collection that represents all the sentences in the document.

public:
 property Microsoft::Office::Interop::Word::Sentences ^ Sentences { Microsoft::Office::Interop::Word::Sentences ^ get(); };
public Microsoft.Office.Interop.Word.Sentences Sentences { get; }
member this.Sentences : Microsoft.Office.Interop.Word.Sentences
Public ReadOnly Property Sentences As Sentences

Property Value

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 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());
}
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 

Applies to