Table of Contents

Class FieldFormula

Namespace
DocWright.Dom.Fields
Assembly
DocWright.Dom.dll

The = (formula) field: an arithmetic and comparison expression over numbers, table cell references and bookmarks (ECMA-376 Part 1 §17.16.5.24).

public static class FieldFormula
Inheritance
FieldFormula
Inherited Members

Remarks

Precedence, lowest to highest: comparison, then + -, then * /, then unary sign, then ^ (right associative), then the postfix %. Word's % is a percent-of-one operator, not a modulus — 50% is 0.5 — and MOD() is the remainder function.

Methods

Evaluate(string?, FieldFormulaContext)

Evaluates a formula expression and returns its unformatted result, or one of the FieldErrors texts. Applying a numeric picture is the caller's job.

FormatNumber(double, CultureInfo)

Formats a formula result the way Word does when no numeric picture is given: an integral value loses its decimal point, everything else keeps up to fifteen significant digits.