Expand Minimize
This topic has not yet been rated - Rate this topic

Document.Characters Property

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

Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)

public virtual Characters Characters { get; }

Property Value

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.

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

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.