Adding a table element

You can create a table and specify the rows and columns from the editing view or by using the palette.

About this task

Tip: In the Microsoft Word and PDF output formats, consecutive tables appear as a single table in the generated output. The columns do not have the same width across these merged tables unless the col width property is set for each of the tables. When tables are merged, it is possible that the same row might display multiple times if the same data is displaying for multiple tables. You can use the once per table property to remove the duplicate rows.

Procedure

  1. In the Palette view, select the Table icon Table element and drag it into the template content editor. The New Table opens.
  2. In the New Table window, enter the number of rows and columns for the table.
  3. Click OK.

What to do next

You can add a container to the table element to help manage the data in the table.
Important: After you add a container to a table, row, or cell element, you cannot move that query outside of the table element. Containers are handled differently inside tables and that context does not apply outside of a table element. Use new container elements when necessary.

Common tasks for customizing the table shape

You can create a table containing cells of different sizes and shapes. Review these common methods for customizing your table.

Before you begin

  1. All rows or columns must contain the same number of cells.
  2. Remove properties set for the individual cells contained in the span.
  3. Avoid overlapping a span with another span.
  4. Generate the output in multiple formats to test the display of the table.

About this task

Few tables have a symmetrical row and column layout like this:
Symmetrical table of three rows and three columns

Instead, you can allow the cells to vary. Your table might have columns that adjust to their content, cells with specific widths, or a cell that spans multiple rows or columns. In most common scenarios, tables come from the data source as rich text, so review the table formatting to ensure that the context still applies in the generated report.

You can customize the table shape with any or all of the following common tasks.

Procedure

  • To allow column widths to adjust based on their content:
    1. Select a table element.
    2. In the Properties view, select the Specific tab.
    3. For the Fixed cell width in column property, select false.

      Template example where the Fixed cell width in column for the table is false:

      Template example

      Output example:

      Output example

      Notice that the first column adjusts to the width of the cell with the largest amount of content.

  • To set a specific width for a column:
    1. Select a cell element.
    2. In the Properties view, select the Specific tab.
    3. For the Cell width property, enter a numeric value in pixels or use a value read from a data source, such as the TableCellWidth attribute from IBM® Rational® DOORS®. For the Cell width property, you can use hardcoded values. These values take precedence over the table properties that adjust column width.
    4. Repeat for the other cells in the column.

      Template example where Cell width for the cells in the first column is 100 pixels:

      Template example

      Output example:

      Output example

      Notice that the first column is wider than the content it contains.

  • To allow the column size to automatically adjust to its contents:
    1. Select the Table.
    2. In the Properties view, select the Specific tab.
    3. For the Table auto fit property, select an option.

      When you customize the details for a table and enter autofit to window as the Table auto fit value, columns increase and decrease in size depending on the amount of content contained within the cell. If a cell does not contain any content, but has a cell width value entered, the cell width value might be adjusted to allot for more or less space based on the content in the other columns. To override this behavior and create a column wider than the content it contains, clear the autofit to window value and enter a numeric value for the column. Example: 500

  • To create a cell that spans multiple columns:
    1. From the Palette view, drag a table into the template content editor.
    2. Select a fixed number of rows and columns to start with.
    3. Select the cell to span multiple columns.
    4. In the Properties view, select the Specific tab.
    5. In the Col span field, enter the number of columns for the cell to span. Example: 2

      Template example where Col span for Cell 4 is 2:

      Template example

      Output example:

      Output example

      Notice that Cell 5 is visible in the template, but in the output, Cell 4 spans two columns and Cell 5 is not visible.

  • To create a cell that spans multiple rows:
    1. From the Palette view, drag a table into the template content editor.
    2. Select a fixed number of rows and columns to start with.
    3. Delete a cell from a row.
    4. Select the cell to span multiple rows.
    5. In the Properties view, select the Specific tab.
    6. In the Row span field, enter the number of rows for the cell to span. Example: 2

      Template example where Row span for Cell 4 is 2:

      Template example

      Output example:

      Output example

      Notice that Cell 7 is visible in the template, but in the output, Cell 4 spans two rows and Cell 7 is not visible.

  • To modify word wrapping in a table:
    1. Select the Table.
    2. In the Properties view, select the Specific tab.
    3. For the Resize to fit contents select an option and click OK.

      You can also modify the Resize to fit contents table property by selecting or clearing the check box. When the check box is selected and Resize to fit contents is true, long text that does not contain any spaces is broken and wrapped within the cell. When the check box is cleared and Resize to fit contents is false, long text that does not contain any spaces is not broken and extends to the edge of the page.

Formatting cells with scripts

About this task

You can apply a border style script:

Procedure

  1. Select a cell element.
  2. In the Properties view, select the Border tab.
  3. If it is not already selected, select the All border icon All border icon. This option is selected by default.
  4. For the Style property, click the ellipsis.
  5. Select the script expression tab and enter the following script:
    if(TableTopBorder == "TableBorderFull")
    {
    "single"
    }
    else if(TableTopBorder == "TableBorderDotted")
    {
    "dotted"
    }
    else if(TableTopBorder == "TableBorderNone")
    {
    "none"
    }
  6. Save the changes.

Feedback