Proprietà DocumentBase.GrammaticalErrors

Ottiene un insieme di ProofreadingErrors che rappresenta le frasi che non hanno superato il controllo grammaticale eseguito nel documento.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Sintassi

'Dichiarazione
Public ReadOnly Property GrammaticalErrors As ProofreadingErrors
    Get
public ProofreadingErrors GrammaticalErrors { get; }

Valore proprietà

Tipo: Microsoft.Office.Interop.Word.ProofreadingErrors
Insieme di ProofreadingErrors che rappresenta le frasi che non hanno superato il controllo grammaticale eseguito nel documento.

Note

È possibile che siano presenti più errori per frase.

Se non sono presenti errori grammaticali, la proprietà Count dell'oggetto ProofreadingErrors restituito dalla proprietà GrammaticalErrors restituirà 0 (zero).

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come aggiungere testo sgrammaticato al primo paragrafo e come verificare la presenza di eventuali errori. Per utilizzare questo esempio, eseguirlo dalla classe ThisDocument in un progetto a livello di documento.

Private Sub DocumentGrammaticalErrors()
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.Text = "This is a ungrammatical sentence."
    Me.CheckGrammar()
    System.Windows.Forms.Application.DoEvents()
    If Me.GrammaticalErrors.Count = 0 Then
        MessageBox.Show("There are no grammatical errors.")
    Else
        Me.CheckGrammar()
    End If
End Sub
private void DocumentGrammaticalErrors()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is a ungrammatical sentence.";
    this.CheckGrammar();
    System.Windows.Forms.Application.DoEvents();
    if (this.GrammaticalErrors.Count == 0 )
    {
        MessageBox.Show("There are no grammatical errors.");
    }
    else
    {
        this.CheckGrammar();
    }
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DocumentBase Classe

Spazio dei nomi Microsoft.Office.Tools.Word