Table of Contents

Method Compute

Namespace
DocWright.Layout
Assembly
DocWright.Layout.dll

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

document WordDocument

The document.

layout LayoutDocument

The document's layout, for Lines (laid out with source references on) and Pages; or null.

includeNotesAndTextBoxes bool

Word's "Include textboxes, footnotes and endnotes" (on in its status bar).

options ResolveOptions

Resolve options (fonts, diagnostics, limits); the revision view is always the final one and source references are always on.

Returns

DocumentStatistics

The counts.

Exceptions

ArgumentNullException

document is 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

document WordDocument

The document.

span DocumentSpan

The selection; an empty one counts nothing.

layout LayoutDocument

The document's layout with source references, for Lines and Pages; or null.

options ResolveOptions

Resolve 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

document is null.

ArgumentException

The span is default or not in document.