DocumentBase.Characters Property

Definition

Gets a Characters collection that represents the characters in the document.

public Microsoft.Office.Interop.Word.Characters Characters { get; }

Property Value

A Characters collection that represents the characters in the document.

Examples

The following code example adds text to the first paragraph and then shows a message box that displays the total number of characters in the document. To use this example, run it from the ThisDocument class in a document-level project.

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

Applies to