Class DocumentStatistics
The counts Word shows in Review > Word Count and the status bar, by Word's rules (WQ-0107): words, characters with and without spaces, East Asian characters, paragraphs, and from a layout lines and pages.
public sealed class DocumentStatistics
- Inheritance
-
DocumentStatistics
- Inherited Members
Remarks
What is counted. The body, its tables included, and with includeNotesAndTextBoxes the
footnotes, endnotes and text boxes; never headers, footers or comments. Hidden text and deleted text are not
counted; inserted text and field results are, field codes are not.
A word is a run of characters between separators: a space, a tab, a no-break space, an ideographic
space, a break, an en or em dash, and a note reference. Each East Asian character (CJK, kana, Hangul, full-width
forms, CJK punctuation) is a word of its own. Anything else is part of a word: -, & and
... standing alone are words, well-known and 3.14 are one each.
Characters are code points (a surrogate pair is one): every character but the separators that are spaces; an en or em dash and a note reference are characters. A zero-width space, a soft hyphen and other format characters are not counted at all. Characters with spaces add the spaces, tabs and line breaks (not page or column breaks), less one for each section break, as Word counts.
A paragraph counts when it holds a character. Lines are the layout's lines of the counted paragraphs, an empty paragraph's included, but not the line of the body's last paragraph when it holds nothing (a space is something). Word counts lines by its own layout; these are DocWright's.
Properties
- Characters
Gets the number of characters, spaces not counted.
- CharactersWithSpaces
Gets the number of characters, spaces, tabs and breaks counted.
- EastAsianCharacters
Gets the number of East Asian characters (Word's "Asian characters, Korean words").
- Lines
Gets the number of lines, or null when no layout was given or it has no lines (source references off).
- Pages
Gets the number of pages, or null when no layout was given.
- Paragraphs
Gets the number of paragraphs that hold a character.
- Words
Gets the number of words.
Methods
- Compute(WordDocument, LayoutDocument?, bool, ResolveOptions?)
Counts a document as Word does.
- Compute(WordDocument, DocumentSpan, LayoutDocument?, ResolveOptions?)
Counts a selection as Word's status bar and Word Count dialog do for one (
Range.ComputeStatistics, WQ-0115): the characters the span covers by the document's rules, a word cut by the span counted as a word; a paragraph counted when the span covers its mark and a character of it, a table cell's last paragraph never; the lines it touches. The body only: footnotes, endnotes and text boxes the span does not reach.