Use Google to find help fast. For example, search on "xpressdox choosefromlist".

The RemoveColumnIf and RemoveRowIf Commands

The RemoveColumnIf and RemoveRowIf Commands

These two commands address some of the frustration involved in trying to include or exclude columns and rows in a Word table.

REMOVECOLUMNIF

It is almost impossible to think of a way to tell XpressDox to include a column in a Word table using «If(condition)» and «End()» to delimit the column boundaries.

Now it is a straightforward process of putting the command

«RemoveColumnIf(condition)»

into any cell in the affected column, and the column will be removed if the “condition” evaluates as true.

The above will remove the column and shift all the columns to the right of it over to the left, shrinking the table.

Often you would not want to shrink the table, but allocate the width of the removed column to another column. This is done like this:

«RemoveColumnIf(Remove = 'Y',3)»

This will increase the width of the third column in the table (counting from the leftmost column as number 1) by the width of the removed column. The number of the column specified is the number before the removed column is removed.

The command below will not actually remove a column but will empty it, leaving the table effectively the same as it was but with that column blanked out.

«RemoveColumnIf(Remove = 'Y',Empty)»

REMOVEROWIF

The conditional inclusion of table rows is easier to visualize.  But when there are complex situations involving, for example, nested «ForEach()» and «If()» commands. Without the «RemoveRowIf()» command the template author is required to perform some gymnastics involving empty rows (which have to be of negligible height), etc.

The «RemoveRowIf()» command enables the author to put all the code into the template to construct a Word table, and then insert

«RemoveRowIf(Remove = 'Y')»

into any cell.  The entire table row containing that command will then be removed from the table if the “condition” evaluates as true.