FieldOptions

FieldOptions class

Represents options to control field handling in a document.

To learn more, visit the Working with Fields documentation article.

public sealed class FieldOptions

Properties

NameDescription
BarcodeGenerator { get; set; }Gets or set custom barcode generator.
BibliographyStylesProvider { get; set; }Gets or sets a provider that returns a bibliography style for the FieldBibliography and FieldCitation fields.
BuiltInTemplatesPaths { get; set; }Gets or sets paths of MS Word built-in templates.
ComparisonExpressionEvaluator { get; set; }Gets or sets the field comparison expressions evaluator.
CurrentUser { get; set; }Gets or sets the current user information.
CustomTocStyleSeparator { get; set; }Gets or sets custom style separator for the \t switch in FieldToc field.
DefaultDocumentAuthor { get; set; }Gets or sets default document author’s name. If author’s name is already specified in built-in document properties, this option is not considered.
FieldDatabaseProvider { get; set; }Gets or sets a provider that returns a query result for the FieldDatabase field.
FieldIndexFormat { get; set; }Gets or sets a FieldIndexFormat that represents the formatting for the FieldIndex fields in the document.
FieldUpdateCultureProvider { get; set; }Gets or sets a provider that returns a culture object specific for each particular field.
FieldUpdateCultureSource { get; set; }Specifies what culture to use to format the field result.
FieldUpdatingCallback { get; set; }Gets or sets IFieldUpdatingCallback implementation
FieldUpdatingProgressCallback { get; set; }Gets or sets IFieldUpdatingProgressCallback implementation.
FileName { get; set; }Gets or sets the file name of the document.
IsBidiTextSupportedOnUpdate { get; set; }Gets or sets the value indicating whether bidirectional text is fully supported during field update or not.
LegacyNumberFormat { get; set; }Gets or sets the value indicating whether legacy (early than AW 13.10) number format for fields is enabled or not.
PreProcessCulture { get; set; }Gets or sets the culture to preprocess field values.
ResultFormatter { get; set; }Allows to control how the field result is formatted.
TemplateName { get; set; }Gets or sets the file name of the template used by the document.
ToaCategories { get; set; }Gets or sets the table of authorities categories.
UseInvariantCultureNumberFormat { get; set; }Gets or sets the value indicating that number format is parsed using invariant culture or not
UserPromptRespondent { get; set; }Gets or sets the respondent to user prompts during field update.

Examples

Shows how to specify the source of the culture used for date formatting during a field update or mail merge.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Insert two merge fields with German locale.
builder.Font.LocaleId = new CultureInfo("de-DE").LCID;
builder.InsertField("MERGEFIELD Date1 \\@ \"dddd, d MMMM yyyy\"");
builder.Write(" - ");
builder.InsertField("MERGEFIELD Date2 \\@ \"dddd, d MMMM yyyy\"");

// Set the current culture to US English after preserving its original value in a variable.
CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

// This merge will use the current thread's culture to format the date, US English.
doc.MailMerge.Execute(new[] { "Date1" }, new object[] { new DateTime(2020, 1, 01) });

// Configure the next merge to source its culture value from the field code. The value of that culture will be German.
doc.FieldOptions.FieldUpdateCultureSource = FieldUpdateCultureSource.FieldCode;
doc.MailMerge.Execute(new[] { "Date2" }, new object[] { new DateTime(2020, 1, 01) });

// The first merge result contains a date formatted in English, while the second one is in German.
Assert.AreEqual("Wednesday, 1 January 2020 - Mittwoch, 1 Januar 2020", doc.Range.Text.Trim());

// Restore the thread's original culture.
Thread.CurrentThread.CurrentCulture = currentCulture;

See Also