Condividi tramite


Proprietà DocumentBase.Characters

Ottiene un insieme di Characters che rappresenta i caratteri del 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 Characters As Characters
    Get
public Characters Characters { get; }

Valore proprietà

Tipo: Microsoft.Office.Interop.Word.Characters
Insieme di Characters che rappresenta i caratteri del documento.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come aggiungere testo al primo paragrafo e come visualizzare una finestra di messaggio contenente il numero totale di caratteri del documento. Per utilizzare questo esempio, eseguirlo dalla classe ThisDocument in un progetto a livello di documento.

    Private Sub DocumentCharacters()
        Me.Paragraphs(1).Range.InsertParagraphAfter()
        Me.Paragraphs(1).Range.Text = "This is sample text."
        MessageBox.Show("Total characters in document: " & Me.Characters.Count)
    End Sub

private void DocumentCharacters()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "This is sample text.";
    MessageBox.Show("Total characters in document: " + this.Characters.Count);
}

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DocumentBase Classe

Spazio dei nomi Microsoft.Office.Tools.Word