Prev | Next |
Custom Table Artifact
The Custom Table artifact is a diagram object that displays custom data in a grid format similar to a spreadsheet. For example:
The benefits of using this element include:
- Providing extra 'non-modeled' information on elements, diagrams or project management exactly where it is applicable, such as a SWAT Analysis or Capability Matrix
- Providing such information in a convenient human-readable and - if appropriate - human-editable format
- The ability to read and update data using scripts and Add-Ins
This feature is available in the Corporate, Unified and Ultimate Editions of Enterprise Architect, from Release 15.0.
Create a Custom Table
From the 'Dynamic Viewpoints' page of the Diagram Toolbox, drag the Custom Table icon onto a diagram.
The Table element is created on the diagram and in the Browser window. On the diagram, click on the element to select it, then drag the borders of the element to expand it to a more comfortable size for editing.
Working with Custom Tables
To modify a Custom Table, it must first be placed into edit mode. To begin editing, right-click the Custom Table element on the diagram and select 'Edit Custom Table'. Alternatively, click on the element and press the
or the key.While in edit mode you can modify and format the table contents.
To exit edit mode, right-click on the element and choose the option 'Exit Edit'. Alternatively, deselecting the table element (by clicking outside of the element, or by pressing the '
' key) will also exit the edit mode.Exiting edit mode will automatically save your changes.
- The Custom Table data content will automatically be saved in XML format into the element's 'data' property.
- The Custom Table row/cell formatting data will automatically be saved in XML format into the 'dataformat' property.
If you update a Custom Table element's properties by directly editing the XML, you can refresh the element in the diagram by right-clicking the element and selecting the option 'Refresh Custom Table'.
Operation |
Description |
See also |
---|---|---|
Define Grid Size |
The new Custom Table element does not yet have a defined grid size.
Columns are autosized to occupy the visual area of the Table element. Rows, however, default to a single line height. |
|
Add More Columns |
You have two options for adding further columns to the table:
|
|
Add More Rows |
You also have two options for adding rows to the table:
|
|
Delete Columns or Rows |
Right-click on a cell in the column or row and select 'Delete Selected Row' or 'Delete Selected Column'. You cannot delete more than one row or column at a time, nor can you delete a row or column containing merged cells (even if they do not contain cells outside the row or column). |
|
Copy Content |
When you have data in the table, you can select to copy the content of either selected cells or the entire table to the clipboard, to paste into an external spreadsheet tool or text file. Select the 'Copy to Clipboard' option and then either 'Selected' or 'All'. |
|
Change Column Width |
Click on a column cell and either drag the border of the column header cell to the required width, or right-click on the Table element and select the 'Set Column(s) Width' option. (To select multiple columns, press the as you select each column.) If you select the 'Set Column(s) Width' option, the 'Set Column Width' dialog displays. Either type in the required width in pixels, or click on the arrows to increase or decrease the value by one pixel per click. Click on the when you have entered the width. Note that:
|
|
Change Row Height |
If you want to increase or decrease the height of one or more rows by one line height, right-click on a cell in that row and select the 'Increase row lines' or 'Decrease row lines' option, as appropriate. (To select multiple rows, press the as you select each row.) If you want to increase or decrease the height of one or more rows by several line heights, right-click on a cell in the selected row(s) and select the 'Set row(s) lines option'. The 'Set Row Lines' dialog displays. Either type in the required height in lines, or click on the arrows to increase or decrease the value by one line per click. Click on the to save the settings. Note that:
|
|
Format the Grid |
You can perform operations to format the appearance of cells in the table, and of the table as a whole. Right-click on the table and select:
- Top - Right - Bottom - Left - Reset Default (to hide the visible borders of the currently-selected cells) Note that the border width is fixed at 1px.
|
|
Add Text to a Cell |
Double-click on the cell and start typing. Alternatively, if you have copied text into the buffer, click twice on the cell, right-click and select the 'Paste' option. Note that formatting (even from another table cell) is not transferred in the copy. |
|
Format Text |
You can perform a number of operations to format the complete text of a cell. The options cannot operate on partial text strings in a cell. Note that these options take effect when you click off the cell. Right-click on the cell and select the required option:
|
Using the Tagged Values
The simplest method for initially defining and populating the Custom Table is to use the context menu options. However, if you want to set up a number of tables of similar structure it becomes more efficient to copy the XML from the Tagged Values of one table to the Tagged Values of another, or to add a script to read and/or populate the tables. Each Tagged Value is a <memo> type that can contain a lengthy collection of XML definitions.
Tagged Value |
Content |
---|---|
data |
As you build up the grid, the basic structure is defined in this Tagged Value in XML, and as you add data values they are inserted into the appropriate lines of the structure definition. For example: <?xml version="1.0"?> <adhoctable> <table> <row> <column>Heading 1</column> <column>Heading 2</column> <column>Heading 3</column> <column>Heading 4</column> <column>Heading 5</column> </row> <row> <column>Rowname</column> <column></column> <column></column> <column></column> <column></column> </row> If you want to enter data directly into the XML in this Tagged Value, the 'Edit Custom Table' context menu must be off (you have selected the 'Exit Editing' option) and you should select the 'Refresh Custom Table' context menu option frequently to update the table image. |
dataFormat |
As you define the format and appearance of the grid, the definition is stored in XML in this Tagged Value. For example: <?xml version="1.0"?> <dataformat> <style> <grid rows="8" columns="5"> <gridcolor>16646398</gridcolor> </grid> <cells> <cell row="0" col="0"> <bold>true</bold> <txtcolor>255</txtcolor> <borders> <left>0</left> <top>0</top> <right>1</right> <bottom>1</bottom> </borders> </cell> <cell row="0" col="1"> <txtcolor>13434880</txtcolor> <borders> <left>0</left> <top>0</top> <right>1</right> <bottom>1</bottom> </borders> </cell> If you want to modify the definition directly in the XML in the Tagged Value, the 'Edit Custom Table' context menu must be off (you have selected the 'Exit Editing' option) and you should select the 'Refresh Custom Table' context menu option frequently to update the table image. |
Custom Table Scripts
You can also associate a JavaScript script with your Custom Table element. Typically, a script might be used to either read data from the table or update the data in the table. Scripts are saved in the operation named 'script'.
Action |
Description |
---|---|
Define a Script |
To define or edit the script:
For detail on the methods available see the ElementGrid Class Help topic. |
Run a Script |
If an associated script has been defined for the table, it can be run by right-clicking the table while it is not in edit mode then choosing the option 'Run Custom Table Script'. |