The "Table Manual" for JafSoft's text conversion utilities

This documentation can be downloaded as part of the documentation set in .zip format


Table of Contents

1 Introduction
2 Getting the structure of the table correct
2.1 Conversion of plain text tables
2.1.1 Overview
2.1.2 Correcting mistakes
2.1.2.1 Getting the detection of tables right
2.1.2.2 Getting the preformatted text correctly recognised as tables
2.1.2.3 Getting the column structure correct
2.1.2.4 Getting the table header correct
2.1.2.5 Getting the cell COLSPAN correct
2.1.2.6 Getting the table formatting right
2.1.3 Tips and tricks
2.1.3.1 Use white space
2.1.3.1 switch on borders
2.1.3.2 Use the BEGIN_TABLE / END_TABLE tags to delimit the table
2.1.3.3 Use the LAYOUT tag to specify the column positions
2.2 Conversion of delimited tables
2.2.1 Specifying a delimited table
2.2.1.1 Tab-delimited data
2.2.1.2 Comma-delimited data
2.2.2 Embedding a regularly updated table in an otherwise static page
2.2.3 Handling quotation marks and commas
2.2.4 Handling multiple lines
2.2.5 Specifing a table heading
2.2.5.1 Using the TABLE_HEADER_ROWS command
2.2.5.2 Adding a line to separate the header from the data
2.3 Conversion of user tagged tables
2.3.1 BEGIN_USER_TABLE ... END_TABLE
2.3.2 COLUMN_DETAILS
2.3.3 NEW_ROW
2.3.4 NEW_CELL
2.3.5 Cell contents
3 Controlling the conversion process
3.1 Using policy files
3.2 Using pre-processor commands
3.3 Using a table definition file
3.3.1 Loading the table definitions file
3.3.2 Defining a table type
3.3.2.1 Table type
3.3.2.2 Must contain
3.3.2.3 Use format
3.3.2.4 Use structure
3.3.3 Defining a table structure
3.3.3.1 Table structure
3.3.3.2 Layout
3.3.4 Defining a table format
3.3.4.1 Table format
3.3.4.2 Column names
3.3.4.3 Caption
3.3.4.4 Table colour
3.3.4.5 Border colour
3.3.4.6 Colour data rows
3.3.4.7 Border size
3.3.4.8 HTML attributes
3.3.4.9 HTML cell attributes
3.3.4.10 Show columns
3.3.4.11 Table css_id
3.3.5 Defining a column format
3.3.6 Defining Cell Alarms
3.3.7 Defining barcharts for numerical columns
3.3.8 Defining custom table headers and footers
3.3.9 Defining table data
Appendix A - Policies
Appendix B - Directives
Appendix C - Table definition commands

1 Introduction

JafSoft's text conversion utilities convert plain ASCII fiels into richer formats such as HTML (AscToHTM) or RTF (AscToRTF). These converters include the ability to detect and convert tables within the text into suitably formatted tables in the output.

Table conversion is a useful aspect of the file conversion, and over the years the functionality has been greatly increased in this area in response to user requirements. The converters can now convert tables in a variety of forms, and accept varying levels of user guidance as to how the table is structured.

At the same time a large number of formatting options give the user control over how the table will appear in the final document.

This manual describes the table handling available in JafSoft products. It is divided into sections as follows

Appendices


2 Getting the structure of the table correct

The converters can create tables from three different types of text

  1. Plain text By default the converters expect to find just plain ASCII text. This text will be analysed to identify regions of preformatted text which is turn are analysed to look for evidence of a tabular structure See Auto-detection of text tables for more details

  2. Delimited data You can embed sets of comma- or tab-delimited data into your source file. This will then be converted into a table using the delimiter to identify the individual cells. See Conversion of delimited tables for more details.

  3. User tagged tables You can embed a set of tagged data. This explititly identifies the rows and cells of the table. This approach may suitable if you are generating your text from a software package that knows what the structure is, as it eliminates the possibility of analysis errors. See Conversion of user tagged tables for more details

2.1 Conversion of plain text tables

2.1.1 Overview

Here's an overview of how the software detects a table in a plain text document, and then works out it's structure. This will give you a feel for the complexity of the issues that need to be addressed.

The software first looks for pre-formatted regions of text. It does this by

  1. Spotting lines that are clearly formatted, looking for large white space and any table-like characters like '|' and '+'. If may also look for code-like lines and diagram-like lines according to the policies set.

2) Each time a heavily formatted line is encountered an attempt is made

to extend the preformatted region by "rolling it out" to adjacent, not so clearly formatted lines

3) This "roll out" process is stopped whenever it encounters a line that is

clearly not part of the formatted region. This might be a section heading or a set of multiple blank lines (the default is 2).

Once a preformatted region is identified, analysis is performed to see whether this is a table, diagram, code sample or something else. This decision depends on

4) The mix of "graphics" characters ('|','-','+','=','*' etc) as opposed

to "text" characters

  1. The presence of "code-like" indicators like curly brackets, semi-colons and "++" and other special character sequences. Note, the software doesn't understand code syntax, it just recognises commonly used character combinations.

  2. How well the data can be fitted into columns of a table (below)

If nothing fits then this text is output "as normal", except that the line structure is preserved to hopefully retain the original meaning.

If the software decides a table is possible, it

  1. Characterizes the contents of each character position. For example if will look at the 3rd character in each line in the input text. If this is mostly blank or "graphics" characters, then character position 3 would be a good candidate for being a column separator.

  2. Looks at the pattern of character position characteristics to infer likely column boundaries. For example is position 10 is half blank, position 11 mostly blank and position 12 almost entirely blank, then this might suggest that position 12 is a column boundary, and text should be allocated to different cells either side of it.

Once a tentative set of column boundaries has been identified, the following steps are repeated

  1. All text is allocated into cells using the current set of column boundaries

  2. A measure is made of how "good a fit" the text is to the columns. The software is looking here to minimise the number of values that span column boundaries, or for columns whose cells are mostly "empty"

  3. Eliminate any apparently "spurious" columns. For example "empty" columns may get merged with their neighbours.

Finally, having settled on a column structure the software

  1. Tries to identify the table header, preferably by detecting a horizontal line near the top of the table.

  2. Tries to work out column alignments etc. For example if the cell contents are numeric the cell will be right aligned, otherwise the placement of the text relative to the column boundaries is observered to decide whether the cell is left, right or center aligned.

  3. Identifies how many lines goes into each row. If blank lines or horizontal rules are present, these may be taken as row boundaries, and the contents of several input lines will be merged to form a single table row.

Once all these calculations have been performed the software

  1. Places all text into cells, using the configuration found. It's only at this stage that any formatting rules requested by the user are applied.

2.1.2 Correcting mistakes

Naturally any one of the automatic steps described in 2.1.1 can go wrong, leading to less than perfect results. Happily the software provides many different ways in which you can correct errors. You can use "policies" passed in a policy file, or "tag directives" added to your source to tell the program how to modify it's analysis of the source text. For fuller description of these techniques read controlling the conversion process


2.1.2.1 Getting the detection of tables right

The software first looks for regions of pre-formatted text. The problems here are usually either that the software is detecting pre-formatted text where it shouldn't, or isn't detecting a large enough region when it should.

Stop the detection of pre-formatted text

Lines with lots of horizontal white space or "table characters" (such as "|". "-". "+") are all candidates for being pre-formatted, especially where several of these lines occur.

This often causes people's .sigs from email to be placed in a table-like structure.

"Look for preformatted text" : no

"Minimum automatic <PRE> size" : <n>

Where <n> is the smallest number of lines that you will allow to be regarded as a region of preformatted text

Make the detected regions larger or smaller

Having detected some preformatted lines, the software tries to "roll out" this region to adjacent lines, i.e. to include them in the region even if, by themselves, they don't appear heavily formatted. If this goes wrong you will either get lines included in the table that shouldn't be there, or you will find lines left out of the table that should be in it. In this last case you may find that a large table is treated as two or more independent tables, with "normal" lines inbetween.

There are a number of actions you can take.

"Table extending factor" : <n>

Where <n> is 1-10. The higher the value, the more likely a table is to include adjacent lines. A value of 10 will include everything up to the next page break or heading.

        $_$_BEGIN_TABLE
        ...
        table lines
        ...
        $_$_END_TABLE

This unambiguously tells the software where your table is (and that it is a table as opposed to anything else). If you can edit your source text then this is best solution.


2.1.2.2 Getting the preformatted text correctly recognised as tables

Once a preformatted region is identified, analysis is performed to see whether this is a table, diagram, code sample or something else. This can occasionaly go wrong, the commonest mistake being that ascii art and tables can get confused.

Solutions include :-

"Look for diagrams" : no

"Expect code samples" : no

If you don't want pre-formatted text output as tables, use the policy

"Attempt TABLE generation" : no

Preformatted text will be output in non-proprtional font (<PRE> in HTML)

???

        Here's a diagram...

        $_$_BEGIN_DIAGRAM
                +-----------+         +-------------+
                +  nice box +-------->+ another box +
                +-----------+         +-------------+
        $_$_END_DIAGRAM

        here's some code

        $_$_BEGIN_CODE
                for (int i=0; i<Max; i++) {
                  print("some more code lines");
                }
        $_$_END_CODE

        here's a table

        $_$_BEGIN_TABLE
                start time      total
                ---------------------
                10:00            124
                11:00             81
        $_$_END_TABLE



2.1.2.3 Getting the column structure correct

This is probably the single most difficult thing that the software attempts. It works well on larger tables with nice regular columns of data. It works worst on smaller tables with large amounts of free-form text. It can also have real problems with the complex table headers often found in reports where some headers will span multiple columns

When the analysis of the table columns has has gone wrong :-

If all this fails you can explicitly tell the software what the table layout is. You can do this in two ways

        $_$_BEGIN_TABLE
        $_$_TABLE_LAYOUT 3, 9,17,27
             Basic Dimensions
        Hole No.    X        Y
        -------------------------
          1       3.2500   5.0150
          2       1.2500   3.1250
        etc.....
        $_$_END_TABLE

In this case the TABLE_LAYOUT states there are three columns with the boundaries at character positions 9, 17 and 27. In a large table of this type this would probably be auto-detected, but if there were only 1 or 2 lines of data, the analysis might go wrong. Tagging the as above would eliminate this ambiguity

2.1.2.4 Getting the table header correct

The software will usually automatically detect the heading is there is a "line" under it like so

             Basic Dimensions
           Hole No.    X        Y
           -------------------------
             1       3.2500   5.0150
             2       1.2500   3.1250
             etc.....

Alternatively you can tell the program how many lines of header there are in the source. You can do this in two ways

        $_$_BEGIN_TABLE
        $_$_TABLE_HEADER_ROWS 2
             Basic Dimensions
        Hole No.    X        Y
          1       3.2500   5.0150
          2       1.2500   3.1250
        etc.....
        $_$_END_TABLE

In this case the TABLE_HEADER_ROWS states there are 2 lines of text to be included in the header (if the header had been underlined, this would be 3 to include the underlining itself)


2.1.2.5 Getting the cell COLSPAN correct

The COLSPAN applied to a cell depends on whether or not data is deemed to straddle a column boundary position. In this the calculation of the correct column structure and the boundary positions is crucial, so you should first check that the columns structure is correct. (See Getting the column structure correct)

Even if the column structure is right, the COLSPAN values can still be wrog sometimes, especially in spanned headers. Basically if you have a space where the column gap is expected the text will be split into cells, if you don't then the text will be placed in a cell with a COLSPAN value that spans several cells.

For example

            | space aligns with column "gap", text will be split into 2 cells
            v
       Basic Dimensions
   Hole No.    X        Y
   -------------------------
     1       3.2500   5.0150
     2       1.2500   3.1250
     etc.....

In this case you'd get "Basic" in column 1 and "Dimensions" spanning columns 2 and 3. If you edit this slightly as follows then the "Basic Dimensions" will span all 3 columns

          | space no longer aligns with "gap".  A COLSPAN=2 cell is created
          v
     Basic Dimensions
   Hole No.    X        Y
   -------------------------
     1       3.2500   5.0150
     2       1.2500   3.1250
     etc.....

It's a bit of a black art.

Sometimes when the table is wrong, it's a good idea to set the BORDER size to 0 (again via the policy options) to make things look not so bad. It's a fudge, but a useful one to know.


2.1.2.6 Getting the table formatting right

Once the table structure has been correctly calculated, you will want to ensure that it is formatted as you would want. Formatting is mostly achieved though passed in policies and tags added to teh source files.

For a fuller description read the chapter Formatting the output of the table


2.1.3 Tips and tricks

2.1.3.1 Use white space

White space can be useful in making a table structure less ambiguous to the software in a number of ways

2.1.3.1 switch on borders

While trying to fine tune the conversion, and to see just how the software has laid out the table, switch on borders. This can be done using the "default TABLE border size" policy. Once you are happy with te structure you can delete this policy from your policy file (which will allow borders to be auto-detected), or switch the policy off should you want.


2.1.3.2 Use the BEGIN_TABLE / END_TABLE tags to delimit the table

If the software wrongly calculates the extent of a table, use the "BEGIN/END_TABLE" tags to explicitly delimit the table in the source document.

See Getting the preformatted text correctly recognised as tables


2.1.3.3 Use the LAYOUT tag to specify the column positions

If the software wrongly calculates the column structure of a table, it may be simpler just to tell the software how the table is laid out by adding "LAYOUT" tags to the source document.

See Getting the column structure correct


2.2 Conversion of delimited tables

As well as converting plain text tables, the software can also converted delimited data into tabular format. The options are less flexible here, but this is the best method to use if you are converting data exported from a spreadsheet.

In each case the table will be created row-by-row from each input line in the source text. The delimiter character will be used to divide the input into cells. COLSPAN and ROWSPAN are not supported in this format.


2.2.1 Specifying a delimited table

The software supports two types of delimiter, tabs and commas

2.2.1.1 Tab-delimited data

Tab-delimited data should be placed between "BEGIN/END_DELIMITED_TABLE" commands as follows

        $_$_BEGIN_DELIMITED_TABLE
        ...
        <lines of comma-delimited text>
        ...
        $_$_END_DELIMITED_TABLE


2.2.1.2 Comma-delimited data

Comma-delimited data should be placed between "BEGIN/END_COMMA_DELIMITED_TABLE" commands as follows

        $_$_BEGIN_COMMA_DELIMITED_TABLE
        ...
        <lines of comma-delimited text>
        ...
        $_$_END_COMMA_DELIMITED_TABLE


2.2.2 Embedding a regularly updated table in an otherwise static page

If you want to create an output file that consists of a regularly updated table inside an otherwise static format, one tip is to use the "INCLUDE" command as follows


        This is text before the table

        $_$_BEGIN_COMMA_DELIMITED_TABLE
        $_$_INCLUDE <name_of_data_file>
        $_$_END_COMMA_DELIMITED_TABLE

        This is text after the table

In the above example the source text contains text before and after the table, as well as the commands to delimit the table itself. The actual data is contained in the file whose name is specified on the INCLUDE statement.

In this way you can regularly export your spreadsheet into a CSV file, and create a template that "includes" the CSV file into the source file that you then convert to get the results file.


2.2.3 Handling quotation marks and commas

If your data contains quotation marks or commas, then the data value should be placed in double quotes. Commas can then be left "as is", but double quotation marks must be doubled up.

For example

"This contains a comma, and a double quotation mark """

becomes

This contains a comma, and a double quotation mark "


2.2.4 Handling multiple lines

At present there is no was of sepcifying multiple lines of text inside a single cell in a delimited table.


2.2.5 Specifing a table heading

There are two ways of specifying that a delimited table has a heading. the first is by using the "TABLE_HEADER_ROWS" command, and the second is by adding a line near the top

2.2.5.1 Using the TABLE_HEADER_ROWS command

As with all tables, you can use the "TABLE_HEADER_ROWS" directive to specify how many input rows are header rows as follows

      $_$_BEGIN_COMMA_DELIMITED_TABLE
      $_$_TABLE_HEADER_ROWS 2
          ,"No." ,"Running"
      Date,"sold","Total"
      1-Jan-2003, 2, 2
      ...
      ... more data lines
      ...
      $_$_END_COMMA_DELIMITED_TABLE

2.2.5.2 Adding a line to separate the header from the data

If a "line" is detected in the table near the top (in the first few lines) this will be taken as a separator between the table header and the data rows.

For example in the following, the row of dashes at row three marks lines 1 and 2 as header lines that will be placed in bold and marked up accordingly

$_$_BEGIN_COMMA_DELIMITED_TABLE

,"No." ,"Running"

Date,"sold","Total"


1-Jan-2003, 2, 2
...
... more data lines
...
$_$_END_TABLE


2.3 Conversion of user tagged tables

In addition to converting plain text files, and sets of delimited data into tables, the software also supports a method of explicitly tagging the input as to how it should be placed in a table.

This may seem extreme, as the point of the converters is to generate the desired markup as save work, but there are a couple of situations in which this approach can be useful.

Here's a sample of a user-tagged table (with blank lines added for clarity) :-

        $_$_BEGIN_USER_TABLE C,1 in
        $_$_COLUMN_DETAILS 1,,,L, 2in
        $_$_COLUMN_DETAILS 2,,,C, 1 ins
        $_$_TABLE_BORDER 1

        $_$_NEW_ROW HEAD
        $_$_NEW_CELL
        Substance (units)
        $_$_NEW_CELL
        Year
        Sampled

        $_$_NEW_ROW DATA
        $_$_NEW_CELL
        Alpha emitters (pCi/L)
        $_$_NEW_CELL
        1999

        $_$_NEW_ROW DATA
        $_$_NEW_CELL
        Asbestos (MFL)
        $_$_NEW_CELL
        1993
        $_$_END_TABLE

Here's how this table appears when converted into the current format

Substance (units)
Year
Sampled
Alpha emitters (pCi/L)
1999
Asbestos (MFL)
1993


2.3.1 BEGIN_USER_TABLE ... END_TABLE

To identfy a section of a source file as a user table, it must be enclosed in the BEGIN_USER_TABLE..END_TABLE commands as follows

        $_$_BEGIN_USER_TABLE <arguments>
        ...
        <other commands to layout the table>
        ...
        $_$_END_TABLE

The BEGIN_USER_TABLE line can take arguments as follows

        $_$_BEGIN_USER_TABLE <alignment>,<margin>

where  
<align>
The alignment of the table. This can be
L(eft), R(ight) or C(enter)
<margin> The margin to be applied to the table. This
consists of a number and a unit. Recognised
units include points ("pts" or "pt"), inches
("ins" or "in") and centimetres ("cm"). In HTML
generation these margins will be approximate only


2.3.2 COLUMN_DETAILS

After the BEGIN_USER_TABLE line will appear a number of COLUMN_DETAILS lines. These are optional, but if present they give details of the characteristics of each column in the table as follows :-

        $_$_COLUMN_DETAILS <col_no>,<align>,<width>

where

<col_no>
This is the column number, starting at 1
<align>
This is the alignment of data in this column.
If omitted this will be auto-detected, but you can
choose to set it to L(eft), R(ight) or C(enter)
<width> The width of the column. If omitted the width will
be caluculated. As with the <margin> on the tabe
the width can be specified in points, inches or
centimetres. If a width is set too narrow, it may
be ignored.

2.3.3 NEW_ROW

Each new row is identifies by the present of a NEW_ROW command on a line by itself. The format is

        $_$_NEW_ROW <row_type>

where

<row_type> This is the row type. Options include
  HEAD This is a header row
DATA This is a data row
LINE This is a line in the table
  The type may be omitted, in which case the default
is "DATA"

except when the NEW_ROW is a "LINE", this command should be followed by a series of NEW_CELL commands and theit matching cell data - normally one per column.


2.3.4 NEW_CELL

Except for "LINE" rows, each new cell in a row identifies by the present of a NEW_CELL command on a line by itself. The contents of the cell follow on subsequent lines until either another NEW_CELL, NEW_ROW or END_TABLE command is encountered.

The format of the NEW_CELL command is

        $_$_NEW_CELL

At present the NEW_CELL command doesn't take any arguments.


2.3.5 Cell contents

Anything following a NEW_CELL command up until the next NEW_CELL, NEW_ROW or END_TABLE commands will be added into the current cell. The line structure will be preserved, so that if you have three lines of text following a NEW_CELL command, this will appear as a cell in the table with three lines of data in it.

The alignment of the cell will normally be that of the column the cell is in. This will either have been calculated automatically for the column as a whole, or will be value passed in via the matching COLUMN_DETAILS line, earlier in the table definition.



3 Controlling the conversion process

3.1 Using policy files


3.2 Using pre-processor commands

3.3 Using a table definition file

If you want to convert a file containing multiple tables, or to convert multiple files containing a variety of tables, it may be useful to create a "table definition" file. In this files you can define multiple table types, and each type can be associated with a particular structure and a particular format.

By associating a table type with a structure, you are telling the software how the table is laid out, thereby simplifying it's task, and reducing the likelihood of analysis errors.

By associating a table type with a format, you can control various aspects of how the final table looks. For example in HTML you can associate CSS styles with columns, allowing tables of a known type to have their columns formatted through an external stylesheet.

Other advanced features are available. For example in HTML it is possible to define alarm conditions to apply to cells in a column, and for the different alarm states to alter the apparance of the cell.


3.3.1 Loading the table definitions file

All the table definition information should be placed in a "Table Definitions file". By convention this file should have a ".inc" extension, but this isn't a requirement.

To have the file loaded, you will need to set a policy line in your policy file of the form

[config files]

Definitions file : table_definitions.inc

This will normally appear in the "[config files]" section of your policy file, but again this isn't strictly necessary.

Once this option appears in your policy file, the table definitions file will be loaded before the conversion process starts. During the conversion each table that is found will be tested against the known table types, and if a match is made, any associated structure and formatting will be applied.



3.3.2 Defining a table type

Table types are defined by having a series of table type sections something like the following in your definition file

        table type      : Rank
        must contain    : Rank ROC5 ROC10 ROC21
        use format      : format_rank
        use structure   : structure_rank

Each table type section starts with the "table type" line, and is followed by a number of additional definition lines that apply to this table type.

NOTE:
The "use format" and "use structure" lines are optional - although you would want at least one to be present for the table type to have any real use.

Each table type section must contain at least one "identifier" line. Identifier lines are those that specify conditions by which tables of this type can be identified.

NOTE: At present the only identifier line supported is the "must contain" line

The identifier line(s) specify conditions that are used to test each table to see if it could be of this type. Commonly the test is a search for text that is present in the header of all tables of this type.

If multiple table type sections are defined, then the first table type whose identifiers match the table is used, so the ordering of table type sections within the definition file can be important.

For example :-

        table type      : type_1
        must contaiu    : Rank
        ...

        table type      : type_2
        must contain    : date Rank
        ...

In the above example any table that contains a line of text containing "date rank" would match both table types. Since type_1 is listed first, all such tables would be treated as type_1. In this case it would be better to define type_2 first as below

        table type      : type_2
        must contain    : date Rank
        ...

        table type      : type_1
        must contaiu    : Rank
        ...

With the above definitions, a table containing "date rank" would be assigned to type_1, one which simply contained "rank" would be type_2


3.3.2.1 Table type

The presence of a "table type" line in the definition file marks the start of a new table type definition. The line has the format

        table type : <type_name>

where <type_name> is the a unique name for this type of table, and shouldn't contain any spaces.


3.3.2.2 Must contain

The "must contain" line is an identifier line. That is it is a condition applied against a candidate table to see if it matches this table type.

The line has the format :

        must contain : <text_to_be_matched>

The candidate table is tested line-by-line, so the text to be matched must be wholly contained within one line of the source text. When testing the match expression the case of the text being tested is ignored, and all multiple white space is treated as a single space. So the match text "Date rank" will match the word "date" followed by any number of spaces and tabs, followed by "rank".

A good use of this line would be to match the know headers in a table, e.g.

must contain : Date Temperature Max Min

would match a table with headers "Date", "temperature", "MAX" and "MIN" if they were in that order, regardless of the spacing.

NOTE: AT present only one "must contain" line per table type is supported


3.3.2.3 Use format

The "use format" line specifies that if a table matches the identifying conditions for this table type, then it should be formatted according to the rules specified in the named table format section.

This line has the form

        use format : <format_name>

where <format_name> is the name of a table format section defined elsewhere in the definition file. The <format_name> should contain no spaces.

The same format may be shared by multiple table types, that is several table type sections could all end up having the same "use format" line.

If the <format_name> given doesn't match a format defined elsewhere in the definition file, then the software will report this error each time it matches a table of this type and then fails to locate the named format. That is it gives a runtime error, rather than reporting the error when the definition file is loaded.

NOTE: This may change in later versions

See Defining a table format


3.3.2.4 Use structure

The "use structure" line specifies that if a table matches the identifying conditions for this table type, then it's structure should be interpretted according to the rules specified in the named table structure section.

This line has the form

        use structure : <structure_name>

where <structure_name> is the name of a table structure section defined elsewhere in the definition file. The <structure_name> should contain no spaces.

The same structure may be shared by multiple table types, that is several table type sections could all end up having the same "use structure" line.

If the <structure_name> given doesn't match a structure defined elsewhere in the definition file, then the software will report this error each time it matches a table of this type and then fails to locate the named structure. That is it gives a runtime error, rather than reporting the error when the definition file is loaded.

NOTE: This may change in later versions

See Defining a table structure

3.3.3 Defining a table structure

      table structure : Percent_funds
      Layout          : 6,31,41,51,61,71,81

3.3.3.1 Table structure

The presence of a "table structure" line in the definition file marks the start of a new table structure definition. The line has the format

        table structure : <structure_name>

where <structure_name> is the a unique name for this structure, and shouldn't contain any spaces. The <structure_name> is the name used in any "Use structure" statement in a table type section.


3.3.3.2 Layout

???

3.3.4 Defining a table format

      table format : Rank
      column names : ,,,ROC5,ROC10,ROC21
      caption                 : Rankings
      table colour            : #E1D1C1
      border colour           : #E2E2E2
      Colour data rows        : Yes
      border size             : 2
      HTML attributes         : onmouseover='click'
      HTML cell attributes    : nowrap
      show columns   : no,no,no,,,,,,,,

3.3.4.1 Table format

The presence of a "table format" line in the definition file marks the start of a new table format definition. The line has the format

        table format : <format_name>

where <format_name> is the a unique name for this format, and shouldn't contain any spaces.

The <format_name> is the name used in any "Use format" statement in a table type section.


3.3.4.2 Column names

???

3.3.4.3 Caption

???

3.3.4.4 Table colour

???

3.3.4.5 Border colour

???

3.3.4.6 Colour data rows

???

3.3.4.7 Border size

???

3.3.4.8 HTML attributes

???

3.3.4.9 HTML cell attributes

???

3.3.4.10 Show columns

???


3.3.4.11 Table css_id

???

3.3.5 Defining a column format

      column format : name=ROC5  css_id=ROC5  alarms="ROC_red,ROC_green"
      column format : name=ROC10 css_id=ROC10 alarms="ROC_red,ROC_green"
      column format : name=ROC21 css_id=ROC21 alarms="ROC_red,ROC_green"

???

3.3.6 Defining Cell Alarms

      alarm : name=ROC_red   type=LE value=0.0 alarm_color=red   cellatts='BGCOLOR="#
      alarm : name=ROC_green type=gt value=0.0 alarm_color=green cellatts='BGCOLOR="#

???

3.3.7 Defining barcharts for numerical columns

???
!- Graph definition. define --------------------------------------------------
! - graph min/max,
! - graph width (in pixels),
! - location of value relative to graph (left, right, center, none)
! - colour of graph
! - bg colour of graph
!
! simple graph defn
!

      Barchart : name=GRAPH_1 width=200 value_location=left color=green null_value=491 null_display="no data"

3.3.8 Defining custom table headers and footers

???

3.3.9 Defining table data

      table data : name=Unit_id  row=1 col=1

???


Table formatting options
There are several options for controlling the formatting of the table.

These include

table css_id
column names
Show columns

Note some of the table format commands depend on the table analysis correctly identifying the columns in your table. If the columns are not correctly identified, then the formats will be applied to the wrong part of the table. See ???

table css_id
Format is

table css_id : <CSS_ID>

The value supplied is used as the CSS ID for the output table. This allows you to attach a stylesheet to the particular table layout. If this line is not present, then the software will generate a unique ID for each table of the type "table_<nn>", where <nn>=1,2,3...


column names
Format is

column names : <format_1>,<format_2>,....

where <format_1> etc are the name of column formats defined elsewhere in the file by a "Column Format" line. Commas are used to separate the names of the formats used for each column.

Formats may be omitted for some columns, and the same format may be used for multiple columns, so the following are both valid

column names : ,,,,temperature,,

column names : date,date,,temperature,,

There should only be one "columm formats" line for each "table format", although this can be omitted.


Show columns
Format is

show columns : <yes_no>,<yes_no>,...

where <yes_no> is either "yes" or "no" or blank. If blank it's taken to be "yes".

This line specifies whether or not each column should be included in the output. If your table has been exported in CSV format from a spreadsheet it may contain "work" columns that you don't want shown. This option allows you to specify that.


Column formatting
Column formats are each defined by a sinmgle line in the definition file. These formats do not belong to any one table format, and may be referenced by multiple table formats, or multiple times by a single table format.

The format is

column format
name=<name> css_id=<id> alarms=<alarm_list> barchart=<bar_name>

Where

<name>
Required. Unique name for the column format.
This is used by table formats to identify which
column format(s) are to be used.
<css_id>
Optional. If present this is the root CSS ID
for cells in the column. Cells in the header (<TH>)
will be assigned the CSS ID "<css_id>_HEAD" while
cells in the main body (<TD>) of the table will be
given the ID "<css_id>", unless they are in an
alarm state which has it's own CSS ID.
<alarms>
Optional. A comma-separated list of Alarms that
the data cells in this column should be tested against.
If multiple alarms are to be tested, they should be
listed in quotes, and in order of precidence.
<barchart> Optional. If present this is the name of a barchart
definition to be applied to the numerical data cells
in this column.

Cell Alarms
Cells in a column can be tested against one or more alarm conditions, according to the list given in the "alarms" attribute of the corresponding "column format" line. The precedence order is the order the alarms are named int the "column format" line.

the format for an Alarm definition is

alarm
name=<name> type=<comparison> css_id=<ID> value=<value> column_value=<column_no> alarm_color=<html_color> cellatts=<html_cell_attributes>

where

name
Required. This is the unique name by which the alarm condition will be reffered to in "Column Format" lines
type
Required. Comparison type. This identified how the cell contents are to be compared to the reference value. Options include
      lt less than
      gt greater than
      le less than or equal to
      ge greater than or equal to
      eq equal to



ne
not equal to
      eqs equal to (string comparison)

 

 

 
nes
 
not equal to (string comparison)
 

css_id
Optional. When present, this is the CSS ID to be applied to any cell that matches this condition. This will override any column CSS ID, and so allow a stylesheet to be created which highlights those cells in an alarm state.
cellatts
Optional. When present, this defines any HTML cell attributes to be added to the <TD> tag for any cell matching the condition. This could be used as an alternative to CSS (not recommended ???

Using Barcharts
For columns of numerical data it is possible to have this displayed in barchart form, with each cell showing a bar whose size is proporiotnal to the value in the cell. If alarms are defined for the cell, then then barchart will take on any alarm colour when the cell's contents match the alarm condition.

the format is :-

Barchart
name=<name> min=<value> max=<value> origin=<value> width=<pixel_value> colour=<HTML_Colour> bgcolor=<HTML_colour> value_location=<alignment>

where

name Required. Unique name by chich this barchar
can be referred to in "column format" statements
Min, Max Optional. The minimum and maximum values at the
extremes of the barchart. If omitted the software
will automatically calculate the min and max value
for the column. If any values in the column lie
outside the specifies range, this will be automatically
extended to cope.
origin Optional. Specifies an "origin" for the barchart.
Values less than this will be shown as barcharts
going to the left, those greater as barcharts to
the right, If omitted, the origin is set to
the min value, so that all barcharts draw to the left.
If you set a value greater than the max, then all
mars will be drawn to the right from.
width Optional. The pixel width for the barchart. The
barchart is if omitted the default width is 200
color Optional. The HTML colour to be used for the barchart
the default is "blue"
bgcolor Optional. The HTML colour to be used for the barchart
background. The default is blank, indicating that
the background of the document should be used.
value_location Optional. Specifies where the numerical value should
be displayed relative to the barchart. Options are
  left
Value is displayed to the left of the bar
  right
Value is dispalyed to the rightof the bar
  center, middle
Value is displayed in the bar itself. If necessary
the bar will be widened. You may have difficulty
reading the text, and if an origin is specified then
this option will be switched to "left"
  none
The value isn't displayed, only the barchart
null_value If present any cell containing this text value will
be deemed to be "null" and won't get a barchart, nor
contribute to any limit calculations.
null_display If any cell is deemed to be "null" by matching the
"null_value" then this value will be displayed
instead of a barchart.


Defining custom table headers and footers
You can customise the HTML put out before and after a table by using the "HTML fragments" feature (described in the Tag manual). You can do this by naming the fragments to be put out before and after the table

Format:-

HTML fragments : <before_fragment_name>, <after_fragment_name>

The statement is a comma separated list fo the before and after fragment names, values can be omitted, so for example

HTML fragments : ,table_trailer

will add the fragment "table_trailer" after the table.

HTML fragments like this can be particularly when combined with "Table data" definitions. These define how to extract data from certain cells in the table.

For example the HTML Fragment

$_$_DEFINE_HTML_FRAGMNET TABLE_HEADER
<H1>Report for customer customer</H1>
$_$_END_BLOCK

will create a heading with the variable "customer" in it. If the Table Data definition

Table Data : name=customer row=2 col=1

then the value in row 2, column 1 would be copied into the "customer" variable, which would then be output in the table header/


Extracting Table data
The Table Data definition identifies data that can be extractfrom the table itself. The main purpose of this is to allow the data to then be used in any HTML fragments, particularly those associated with the table header and footer

Format:-

table data : name=<name> row=<row_no> col=<col_no>

where

name
Required. The name given to the data item. This should be unique, and will be the name assigned to the VARIABLE tag that will display the extracted data.

row, col Required. The row and column number that the data is to be

extracted from.


Appendix A - Policies

???

Appendix B - Directives

???

Appendix C - Table definition commands

????


Valid HTML 4.0! Converted from a single text file by AscToHTM
© 1997-2003 John A. Fotheringham
Converted by AscToHTM