xml spy
Previous  Top  Next

Creating Dynamic Tables


Creating a dynamic SPS table

A dynamic SPS table is created by dragging an element from the XML tree into the Design window. On dropping the element into the desired location, the following context menu appears.

 

tbl_menu_create_table

 

Click Create Table. This brings up the following dialog.

 

dlg_create_dyn_table_1

 

The child elements and attributes of the element that has been dragged into the Design window are displayed In the "Select attributes/element" list and can be created as columns of the table. Deselect the child nodes that you do not want and select any attribute/element you want to include as columns. (In the figure above, the elements Shares, LeaveTotal, LeaveUsed and LeaveLeft have been deselected.)

 

Note that columns are created only for child elements and attributes, but for no descendant on a lower level.

 

Table grows down or right

When a table grows top-down, this is what it would look like:

 

tbl_table_grows_down

 

When a table grows left-right it looks like this:

 

tbl_table_grows_right

 

 

Headers and footers

Columns can be given headers, which will be the names of the column elements. To include headers, check the Create Header check-box. To include footers, check the Create Footer check-box. Footers can only be created for tables that grow top-down. The footer of numeric columns will also sum each of these columns if the Summary for Numeric Fields check box is checked.

 

Header and footer cells can be joined and split, and rows can be inserted, appended, and deleted; this gives you considerable flexibility in structuring headers and footers. Additionally, headers and footers can contain any type of static or dynamic content, including conditional templates and auto-calculations.

 

Note: Headers and footers must be created when the dynamic table is defined. You do this by checking the Create Header and Create Footer options in the Create Dynamic Table dialog. Appending or inserting a row within a dynamic table does not create headers or footers but an extra row. The difference is significant. Real headers and footers are added to the top and bottom of a table, respectively, and to the top and bottom of the table on new pages if the table runs on to a new PDF page. If a row is inserted or appended, then the row occurs for each occurrence of the element that has been created as a dynamic table.

 

 

Nested dynamic tables

You can nest one dynamic table within another dynamic table if the element for which the nested dynamic table is to be created is a child of the element that has been created as the containing dynamic table. Do the following:

 

1.Create the outer dynamic table so that the child element to be created as a dynamic table is created as a column.
2.In the dynamic table in Design View, right-click the child element.
3.Select Change to | Table. This pops up the Create Dynamic Table dialog.
4.Define the properties of the nested dynamic table.

 

To nest a dynamic table in a static table, drag the element to be created as a dynamic table into the required cell of the static table. When you drop it, select Create Table from the context menu that appears.

 

 

Tables for elements with text content

To create columns (or rows) for child elements, the element being created as a table must have a child element or attribute node. Having a child text node does not work. If you have this kind of situation, then create a child element called, say, Text, and put your text node in the TableElement/Text elements. Now you will be able to create TableElement as a dynamic table. This table will have one column for Text elements. Each row will therefore contain one cell containing the text node in Text, and the rows of the table will correspond to the occurrences of the TableElement element.

 

 

Contents of table body cells

When you create a dynamic table, you can create the node content as any one of a number of StyleVision components. In the examples above, the table body cells were created as contents. They could also have been created as data-entry devices. There are two points to note here:

 

The setting you select is a global setting for all the table body cells. If you wish to have an individual cell appear differently, edit the cell after you have created the table: right-click in the cell and, in the context menu that appears, select "Change to" and then the required cell content type.
If you create cells as element contents, and if the element has descendant elements, then the content of the cell will be a concatenation of the text strings of the element and all its descendant elements.

 

 

Deleting columns, rows, and tables

To delete a column, row, or table, place the cursor in the column, row, or table to be deleted, and click the menu item Table | Delete Column, Table | Delete Row, or Table | Delete Table, respectively. If you have nested tables, the table immediately containing the cursor will be deleted when the Table | Delete Table command is used.

 

 

Toolbar table editing icons

The table editing icons in the second row of the toolbar are shortcuts to the Table menu commands. These commands allow you to insert, delete, edit the structure of, and assign formatting properties to the dynamic table. These icons can also be used for static tables. They cannot be used for XML tables, since XML tables cannot be created in StyleVision but must be created in Authentic View by the user. XML tables can only be enabled in StyleVision.

 

 

Creating dynamic tables in global templates

You can also create dynamic tables in global templates. The process works in the same way as for the Root Template (given above). The important point to note is that, in a global template, a dynamic table can only be created for descendant elements of the global template node; it cannot be created for the global template node itself. For example, if you wish to create a dynamic table for the element authors within a global template, then this dynamic table must be created within the global template of the parent element of authors. It cannot be created within the global template of the authors element.

 

 


See also:

 

 


 

 


Previous  Top  Next

© 2008 Altova