[]
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
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:
Name | Description |
---|---|
DataSources | Gets the collection of data sources associated with the current document's data templates. |
Options | Gets options controlling the behavior of the template processing engine. |
Name | Description |
---|---|
BatchProcess(Action, CultureInfo) | Iterates over root items in DataSources, starting with a fresh copy of the document and processing templates separately for each root data item.
The 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). |
DebugExpandTemplate(bool, CultureInfo) | Expands the template. The template will be processed and all missed tags added. |
Process(CultureInfo) | Processes templates in the document, iterating over root items in DataSources, and replacing template tags in the document with data. |
Validate(bool) | Validates all templates in the current document, finds any template tags that are malformed or used incorrectly. |