Word Append Table
Word Append Table
Section titled “Word Append Table”Type: word-append-table · Package: Word Activities v1.0.4
Appends a DataTable as a table in the document, with single borders and, optionally, a bold header row. It is how you include tabular data in a generated report: a sales detail, a results table.
How it works
Section titled “How it works”Inserts table as a Word table at the end of the document. By default it writes the column names as a bold first row (hasHeader = true). It only works inside a session; the change stays in memory until the document is saved.
- Each cell is written as text (the value converted to text; nulls stay empty). If you need a specific format (dates, currency), prepare the column first with DataTable.
- All cells get a single border; Word adjusts the column widths when it opens the document.
- A DataTable with no rows adds only the header row (if
hasHeader = true). hasHeaderis set in the editor; it does not accept expressions.
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
table | DataTable | — | The DataTable to insert. |
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanWordSession | — | Word session. Inherited automatically inside a body. |
hasHeader | bool | true | Write the column names as a bold header row. |
Output
Section titled “Output”This activity does not return a value.
Example
Section titled “Example”DB Query sql = "SELECT Product, Quantity, Total FROM Sales WHERE Month = @month" params = { "month": month } → output: salesWord Create path = "C:/reports/sales.docx" └─ body: Word Append Paragraph text = "Sales Detail" style = Heading1 Word Append Table table = salesCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'table' must be a DataTable. | The table value is not a DataTable (for example, a list or a text). Convert the data to a DataTable first. |
'session' must be a valid Word session (use word-open or word-create). | The activity is outside a Word Create/Open body and got no session. |
Related activities
Section titled “Related activities”- Word Read Tables — the reverse operation: read tables.
- Word Append Paragraph — add text.