[]
Provides properties and methods that are used to associate a GcWordDocument with template data sources, and to process data templates. See remarks for details.
public class DataTemplate
Data templates have the form of "{{ds.value_path}[:formatter1(args1):formatter2(args2):..formatterN(argsN)]}", where
## Range tags:
Open and close tags resolve start and end of a repeating section of data. If omitted, the template engine will automatically calculate start and end of a repeating block. If 'ds' is the name of a data set:{{#ds}}{{#ds.cities}}{{ds.cities.name}:toupper()}{{/ds.cities}}{{/ds}}
Arrays of elementary types can be used as data sources. To address array elements, use the "value" tag. E.g. if the "ds" data source is such an array, "ds.value" will expand to the array elements' values. The following elementary types are supported: Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Char, Double, Single and String.
Many formatters allow hiding a block of data if a certain condition is met. All such formatters have two equivalent forms - 'hide-block-if-<condition>' and the short form 'hbi-<condition>'. Conditions are self-explanatory.
## Range behavior modifying formatters:
## Block hiding formatters:
These formatters hide a block of data if the value in the block meets a condition.## Value formatters:
## String formatters:
## Date and time formatters (applicable to DateTime and DateTimeOffset):
## Date and time formatters (applicable to DateTime):
## Image formatters:
Image formatters convert a value to an image and insert it into the document. The value must be of one of the following types:## Miscellaneous formatters:
Gets the collection of data sources associated with the current document's data templates.
public DataSourceDictionary DataSources { get; }
Data templates have the form of "{{ds.value_path}[:formatter1(args1):formatter2(args2):..formatterN(argsN)]}", where
## Range tags:
Open and close tags resolve start and end of a repeating section of data. If omitted, the template engine will automatically calculate start and end of a repeating block. If 'ds' is the name of a data set:{{#ds}}{{#ds.cities}}{{ds.cities.name}:toupper()}{{/ds.cities}}{{/ds}}
Arrays of elementary types can be used as data sources. To address array elements, use the "value" tag. E.g. if the "ds" data source is such an array, "ds.value" will expand to the array elements' values. The following elementary types are supported: Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Char, Double, Single and String.
Many formatters allow hiding a block of data if a certain condition is met. All such formatters have two equivalent forms - 'hide-block-if-<condition>' and the short form 'hbi-<condition>'. Conditions are self-explanatory.
## Range behavior modifying formatters:
## Block hiding formatters:
These formatters hide a block of data if the value in the block meets a condition.## Value formatters:
## String formatters:
## Date and time formatters (applicable to DateTime and DateTimeOffset):
## Date and time formatters (applicable to DateTime):
## Image formatters:
Image formatters convert a value to an image and insert it into the document. The value must be of one of the following types:## Miscellaneous formatters:
Gets options controlling the behavior of the template processing engine.
public DataTemplateOptions Options { get; }
Data templates have the form of "{{ds.value_path}[:formatter1(args1):formatter2(args2):..formatterN(argsN)]}", where
## Range tags:
Open and close tags resolve start and end of a repeating section of data. If omitted, the template engine will automatically calculate start and end of a repeating block. If 'ds' is the name of a data set:{{#ds}}{{#ds.cities}}{{ds.cities.name}:toupper()}{{/ds.cities}}{{/ds}}
Arrays of elementary types can be used as data sources. To address array elements, use the "value" tag. E.g. if the "ds" data source is such an array, "ds.value" will expand to the array elements' values. The following elementary types are supported: Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Char, Double, Single and String.
Many formatters allow hiding a block of data if a certain condition is met. All such formatters have two equivalent forms - 'hide-block-if-<condition>' and the short form 'hbi-<condition>'. Conditions are self-explanatory.
## Range behavior modifying formatters:
## Block hiding formatters:
These formatters hide a block of data if the value in the block meets a condition.## Value formatters:
## String formatters:
## Date and time formatters (applicable to DateTime and DateTimeOffset):
## Date and time formatters (applicable to DateTime):
## Image formatters:
Image formatters convert a value to an image and insert it into the document. The value must be of one of the following types:## Miscellaneous formatters:
Iterates over root items in DataSources, starting with a fresh copy of the document and processing templates separately for each root data item.
The itemProcessed
action is called as each data item is processed.
This action can be used to save the current version of the document (containing data
only from the current root data item).
When this method completes, the document is restored to the original state (i.e. it will contain the original template tags rather than data values).
public void BatchProcess(Action itemProcessed, CultureInfo cultureInfo = null)
itemProcessed
System.ActionThe action to be invoked after each root data item is processed.
cultureInfo
System.Globalization.CultureInfoCulture used to format data values. If null, the current culture is used.
Data templates have the form of "{{ds.value_path}[:formatter1(args1):formatter2(args2):..formatterN(argsN)]}", where
## Range tags:
Open and close tags resolve start and end of a repeating section of data. If omitted, the template engine will automatically calculate start and end of a repeating block. If 'ds' is the name of a data set:{{#ds}}{{#ds.cities}}{{ds.cities.name}:toupper()}{{/ds.cities}}{{/ds}}
Arrays of elementary types can be used as data sources. To address array elements, use the "value" tag. E.g. if the "ds" data source is such an array, "ds.value" will expand to the array elements' values. The following elementary types are supported: Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Char, Double, Single and String.
Many formatters allow hiding a block of data if a certain condition is met. All such formatters have two equivalent forms - 'hide-block-if-<condition>' and the short form 'hbi-<condition>'. Conditions are self-explanatory.
## Range behavior modifying formatters:
## Block hiding formatters:
These formatters hide a block of data if the value in the block meets a condition.## Value formatters:
## String formatters:
## Date and time formatters (applicable to DateTime and DateTimeOffset):
## Date and time formatters (applicable to DateTime):
## Image formatters:
Image formatters convert a value to an image and insert it into the document. The value must be of one of the following types:## Miscellaneous formatters:
Expands the template. The template will be processed and all missed tags added.
public void DebugExpandTemplate(bool simpleModeEnabled = true, CultureInfo culture = null)
simpleModeEnabled
boolAllows parsing templates without a data source tag.
culture
System.Globalization.CultureInfoCulture used to format data values.
Data templates have the form of "{{ds.value_path}[:formatter1(args1):formatter2(args2):..formatterN(argsN)]}", where
## Range tags:
Open and close tags resolve start and end of a repeating section of data. If omitted, the template engine will automatically calculate start and end of a repeating block. If 'ds' is the name of a data set:{{#ds}}{{#ds.cities}}{{ds.cities.name}:toupper()}{{/ds.cities}}{{/ds}}
Arrays of elementary types can be used as data sources. To address array elements, use the "value" tag. E.g. if the "ds" data source is such an array, "ds.value" will expand to the array elements' values. The following elementary types are supported: Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Char, Double, Single and String.
Many formatters allow hiding a block of data if a certain condition is met. All such formatters have two equivalent forms - 'hide-block-if-<condition>' and the short form 'hbi-<condition>'. Conditions are self-explanatory.
## Range behavior modifying formatters:
## Block hiding formatters:
These formatters hide a block of data if the value in the block meets a condition.## Value formatters:
## String formatters:
## Date and time formatters (applicable to DateTime and DateTimeOffset):
## Date and time formatters (applicable to DateTime):
## Image formatters:
Image formatters convert a value to an image and insert it into the document. The value must be of one of the following types:## Miscellaneous formatters:
Processes templates in the document, iterating over root items in DataSources, and replacing template tags in the document with data.
public void Process(CultureInfo cultureInfo = null)
cultureInfo
System.Globalization.CultureInfoCulture used to format data values. If null, the current culture is used.
Data templates have the form of "{{ds.value_path}[:formatter1(args1):formatter2(args2):..formatterN(argsN)]}", where
## Range tags:
Open and close tags resolve start and end of a repeating section of data. If omitted, the template engine will automatically calculate start and end of a repeating block. If 'ds' is the name of a data set:{{#ds}}{{#ds.cities}}{{ds.cities.name}:toupper()}{{/ds.cities}}{{/ds}}
Arrays of elementary types can be used as data sources. To address array elements, use the "value" tag. E.g. if the "ds" data source is such an array, "ds.value" will expand to the array elements' values. The following elementary types are supported: Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Char, Double, Single and String.
Many formatters allow hiding a block of data if a certain condition is met. All such formatters have two equivalent forms - 'hide-block-if-<condition>' and the short form 'hbi-<condition>'. Conditions are self-explanatory.
## Range behavior modifying formatters:
## Block hiding formatters:
These formatters hide a block of data if the value in the block meets a condition.## Value formatters:
## String formatters:
## Date and time formatters (applicable to DateTime and DateTimeOffset):
## Date and time formatters (applicable to DateTime):
## Image formatters:
Image formatters convert a value to an image and insert it into the document. The value must be of one of the following types:## Miscellaneous formatters:
Validates all templates in the current document, finds any template tags that are malformed or used incorrectly.
public IEnumerable<TemplateError> Validate(bool markErrors = false)
markErrors
boolIf true, erroneous tags will be marked in the document, and a Comment with the error description will be added to each such occurrence. If false, the templates will be left as is, just the list of errors will be returned.
The list of all found template errors.
Data templates have the form of "{{ds.value_path}[:formatter1(args1):formatter2(args2):..formatterN(argsN)]}", where
## Range tags:
Open and close tags resolve start and end of a repeating section of data. If omitted, the template engine will automatically calculate start and end of a repeating block. If 'ds' is the name of a data set:{{#ds}}{{#ds.cities}}{{ds.cities.name}:toupper()}{{/ds.cities}}{{/ds}}
Arrays of elementary types can be used as data sources. To address array elements, use the "value" tag. E.g. if the "ds" data source is such an array, "ds.value" will expand to the array elements' values. The following elementary types are supported: Boolean, Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Char, Double, Single and String.
Many formatters allow hiding a block of data if a certain condition is met. All such formatters have two equivalent forms - 'hide-block-if-<condition>' and the short form 'hbi-<condition>'. Conditions are self-explanatory.
## Range behavior modifying formatters:
## Block hiding formatters:
These formatters hide a block of data if the value in the block meets a condition.## Value formatters:
## String formatters:
## Date and time formatters (applicable to DateTime and DateTimeOffset):
## Date and time formatters (applicable to DateTime):
## Image formatters:
Image formatters convert a value to an image and insert it into the document. The value must be of one of the following types:## Miscellaneous formatters: