Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Word and tables

How DataTable/ResultSet can be used in Word. Header metadata.

Two basic ways to use a single DataTable/ResultSet: when column count is unknown and when column count is known. Templater will respect the width of the table. When column count is know detailed style can be applied to it.

Dynamic resize

DataTable/ResultSet can be used in dynamic resize way (sending them to low level API). In this case table will be stretched to match rows and columns in provided instance. To inject column names, :header metadata must be used; otherwise only data will be imported.

Standard processing

Templater has built-in processor for DataTable/ResultSet, which knows how to process them. In that case more style formatting can be applied on the document.

merge-nulls/span-nulls metadata

Specific internal metadata (meaning it can't be implemented as a simple plugin) are merge-nulls and span-nulls. They can be used for merging cells when they contain null value.

Section support + custom handler for removing sections

Templater uses document structure to infer beginning/end of the replicating context. Along the table/list/page/whole document as of v2.5 Templater supports sections. When all specified tags are inside a section that range will be used as a context. Example shows how to display special table when there are no rows (since default behavior is just to remove the template row - and leave the header). Appropriate section will be removed based on the custom metadata and the appropriate handler. Handler will iterate through all tags with the same name and either invoke collapse of that region or hide the tag.

Combining multiple features

For complex documents it's often required to combine multiple features, such as in this case dynamic resize with a static part of the table.

Fixed metadata

When Templater detectes fixed in collection metadata, it will avoid calling the resize on it and will cleanup the remaining tags after it has finished processing the collection. When collection is larger than the number of rows in the template, the remaining rows will not be replaced. If fixed is used in Excel, a table should be used to differentiate between other tags in ordinary cells, otherwise only first row will be processed.

You can’t perform that action at this time.