Expand Minimize

DocumentBase.Characters Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

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

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public Characters Characters { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Characters
A Characters collection that represents the characters in the document.

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft