Table of Contents

Class FieldFormatting

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

Applies a field's result-formatting switches: # numeric pictures, @ date/time pictures and * general formats (ECMA-376 Part 1 §17.16.4).

public static class FieldFormatting
Inheritance
FieldFormatting
Inherited Members

Remarks

Every entry point takes an explicit CultureInfo. Field results are document content, so a picture must format the same way regardless of the thread culture the host happens to be running under; the tr-TR test leg exists to catch the one call that forgot.

Methods

ApplyGeneralFormat(string, string?, CultureInfo)

Applies a * general format to a result. Formatting-only switches (MERGEFORMAT, CHARFORMAT) return the value unchanged — they direct how the result runs are formatted, which is the updater's job, not a text transform.

FormatDate(DateTimeOffset, string, CultureInfo)

Formats a date through a Word date/time picture such as dd MMMM yyyy or h:mm am/pm.

FormatNumeric(double, string, CultureInfo)

Formats a number through a Word numeric picture such as #,##0.00 or \(#,##0.00;(\)#,##0.00);'-'.

TranslateDatePicture(string)

Translates a Word date/time picture into a .NET custom date format string.

TranslateNumericPicture(string)

Translates a Word numeric picture into a .NET custom numeric format string. The two syntaxes overlap almost entirely; the differences that matter are that % and ‰ scale the value in .NET but are literal in Word, and that Word uses </code> to escape.