Właściwość DocumentBase.Sentences —

Pobiera Sentences , która reprezentuje wszystkie zdania w dokumencie.

Przestrzeń nazw:  Microsoft.Office.Tools.Word
Zestaw:  Microsoft.Office.Tools.Word.v4.0.Utilities (w Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Składnia

'Deklaracja
Public ReadOnly Property Sentences As Sentences
public Sentences Sentences { get; }

Wartość właściwości

Typ: Microsoft.Office.Interop.Word.Sentences
A Sentences , która reprezentuje wszystkie zdania w dokumencie.

Przykłady

Poniższy kod dodaje dwa zdania do dokumentu, a następnie wyświetla komunikat, który zawiera liczbę zdań w dokumencie.Aby wykorzystać ten przykład, należy uruchomić go z klasy ThisDocument w projekcie na poziomie dokumentu.

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

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

DocumentBase Klasa

Przestrzeń nazw Microsoft.Office.Tools.Word