Class FieldBuilder
Builds fields with typed Word instructions.
Inherited Members
Namespace: DRIT.Document
Assembly: DRIT.Document.dll
Syntax
public sealed class FieldBuilder
Constructors
FieldBuilder(FieldType)
Initializes a builder for the specified field type.
Declaration
public FieldBuilder(FieldType fieldType)
Parameters
| Type | Name | Description |
|---|---|---|
| FieldType | fieldType | The type of field to create. |
Properties
FieldType
Gets the field type being built.
Declaration
public FieldType FieldType { get; }
Property Value
| Type | Description |
|---|---|
| FieldType |
Methods
AddArgument(string)
Adds an unquoted instruction argument.
Declaration
public FieldBuilder AddArgument(string argument)
Parameters
| Type | Name | Description |
|---|---|---|
| string | argument | The argument text. |
Returns
| Type | Description |
|---|---|
| FieldBuilder | This builder. |
AddQuotedArgument(string)
Adds an instruction argument surrounded by double quotes.
Declaration
public FieldBuilder AddQuotedArgument(string argument)
Parameters
| Type | Name | Description |
|---|---|---|
| string | argument | The argument text. |
Returns
| Type | Description |
|---|---|
| FieldBuilder | This builder. |
AddSwitch(string)
Adds a flag switch such as \h.
Declaration
public FieldBuilder AddSwitch(string switchName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | switchName | The switch name, with or without its leading backslash. |
Returns
| Type | Description |
|---|---|
| FieldBuilder | This builder. |
AddSwitch(string, string)
Adds a switch with a quoted value such as @ "yyyy-MM-dd".
Declaration
public FieldBuilder AddSwitch(string switchName, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | switchName | The switch name, with or without its leading backslash. |
| string | value | The switch value. |
Returns
| Type | Description |
|---|---|
| FieldBuilder | This builder. |
Build()
Creates a Field from the configured values.
Declaration
public Field Build()
Returns
| Type | Description |
|---|---|
| Field | The created field. |
WithDirty(bool)
Sets whether the field is marked dirty.
Declaration
public FieldBuilder WithDirty(bool isDirty = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isDirty | The dirty state. |
Returns
| Type | Description |
|---|---|
| FieldBuilder | This builder. |
WithLocked(bool)
Sets whether the field is locked.
Declaration
public FieldBuilder WithLocked(bool isLocked = true)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | isLocked | The lock state. |
Returns
| Type | Description |
|---|---|
| FieldBuilder | This builder. |
WithResult(string)
Sets the displayed field result.
Declaration
public FieldBuilder WithResult(string result)
Parameters
| Type | Name | Description |
|---|---|---|
| string | result | The result text. |
Returns
| Type | Description |
|---|---|
| FieldBuilder | This builder. |