Method Compute
Compute(WordDocument, LayoutDocument?, bool, ResolveOptions?)
Counts a document as Word does.
public static DocumentStatistics Compute(WordDocument document, LayoutDocument? layout = null, bool includeNotesAndTextBoxes = true, ResolveOptions? options = null)
Parameters
documentWordDocumentThe document.
layoutLayoutDocumentThe document's layout, for Lines (laid out with source references on) and Pages; or null.
includeNotesAndTextBoxesboolWord's "Include textboxes, footnotes and endnotes" (on in its status bar).
optionsResolveOptionsResolve options (fonts, diagnostics, limits); the revision view is always the final one and source references are always on.
Returns
- DocumentStatistics
The counts.
Exceptions
- ArgumentNullException
documentis null.
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.
public static DocumentStatistics Compute(WordDocument document, DocumentSpan span, LayoutDocument? layout = null, ResolveOptions? options = null)
Parameters
documentWordDocumentThe document.
spanDocumentSpanThe selection; an empty one counts nothing.
layoutLayoutDocumentThe document's layout with source references, for Lines and Pages; or null.
optionsResolveOptionsResolve options, as for the whole document.
Returns
- DocumentStatistics
The counts; Pages is the layout's page count, as Word's dialog shows it.
Exceptions
- ArgumentNullException
documentis null.- ArgumentException
The span is default or not in
document.