BRYTER provides multiple ways to present data in automatically generated documents, particularly when working with tables in Microsoft Word templates:
- Tabular data: For example, generating a list of employees, each with their name and position. A table is added to the document template, which can be automatically populated with data from a collection.
- Non-tabular data: Using variables to manually create tables, although this can be prone to formatting issues like empty rows or columns where data is missing (e.g., if a user skips a response).
To avoid empty rows and columns in your generated documents, you can use the commands:
- Delete row: {{\dr}} and {{\dr-if-cell-empty}}
- Delete column: {{\dc}} and {{\dc-if-cell-empty}}
These commands ensure that your table remains neatly formatted without any unnecessary empty rows or columns.
Variables in tables
When preparing your template and equipping it with placeholders, you also can put your placeholders in a table:
In this example, placeholders such as {{CEO_label}}
and {{CEO_name}}
will be replaced with actual values during document generation based on user input.
Deleting empty rows
When using tables, there may be cases where certain rows contain no data (i.e., all variables in that row are empty). To prevent these empty rows from appearing in the final document, you can use the delete row commands:
Delete row if all cells are empty {{\dr}}
Add the {{\dr}} tag to a row in your table. This will delete the entire row only if all cells within that row are empty.
{{CEO_label}} {{\dr}} | {{CEO_name}} |
In this example, if both {{CEO_label}}
and {{CEO_name}}
are empty, the row will be removed.
Delete row if specific cell is empty {{\dr-if-cell-empty}}
Use {{\dr-if-cell-empty}} to delete an entire row if a specific cell in that row is empty, even if other cells contain data. This is especially useful when only one key piece of information determines whether a row should appear or not.
{{CEO_label}} | {{CEO_name}} {{\dr-if-cell-empty}} |
In this case, the row is deleted only if {{CEO_name}}
is empty, regardless of whether {{CEO_label}}
has data. The same applies to the following scenario, where we have static text instead of the variable {{CEO_label}}
:
CEO | {{CEO_name}} {{\dr-if-cell-empty}} |
Deleting empty columns
Similar to rows, there are cases where an entire column contains no data. You can use the following commands to automatically remove those empty columns:
Delete Column if All Variables are Empty ({{\dc}})
Add the {{\dc}} tag to a placeholder in a column. This command will delete the entire column if all placeholders in the column are empty.
{{company_name}} | {{CEO_name}} | {{company_name_source}} {{\dc}} |
In this example, if all placeholders in the {{company_name_source}}
column are empty, the entire column will be removed.
Delete Column if Specific Cell is Empty {{\dc-if-cell-empty}}
With {{\dc-if-cell-empty}}, you can delete an entire column based on whether a specific placeholder in that column is empty.
{{company_name}} | {{CEO_name}} | {{company_name_source}} {{\dc-if-cell-empty}} |
The column will only be deleted if {{company_name_source}}
is empty, regardless of the other placeholders in the same column.
ACME Corp. | John Doe | {{company_name_source}} {{\dc-if-cell-empty}} |