Tables
- Caitlin Gebhard (Unlicensed)
- Sylvia Hunter (Unlicensed)
All tables, or content styled with the Table elements of the paragraph styles palette, must be in Word table format. Otherwise, export is likely to produce parsing errors. All content for each table should be in a single Word table. Splitting content for a single table across multiple Word tables will likely result in incorrect XML and may result in parsing errors.
Tables will be exported to either XHTML or CALS format in the XML file, depending on how your configuration is set up. If the weight and/or style of table borders is significant in your XML and/or you need to support table shading in the XML, we recommend using the XHTML table model, as it has stronger support for borders and shading.
By default, eXtyles does not retain shading on export; contact eXtyles-support@inera.com if you need to add support for Word shading in tables.
The more formatting you set correctly in Word, the more that formatting will be correctly reflected in the XML (cell alignment, column widths, cell borders). Note that eXtyles supports the use of the decimal tab in Word tables, as well as left- and right-aligned and centered content.
Alignment
This relatively simple table has been set up with the headings of columns 2 and 3 centered and with the contents of column 1 left aligned, column 2 centered and column 3 aligned on a decimal tab. The cells in the top row carry the Table_Head style, while the other rows are styled as Table_Body.
This yields the following XML (with tables exported as XHTML):
<table frame="hsides" rules="groups"> <col width="27.12%"/> <col width="41.94%"/> <col width="30.94%"/> <tbody> <tr> <td valign="top" align="left" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt" scope="row">Strain<hr/></td> <td valign="top" align="left" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">G+C content (mol%)<hr/></td> <td valign="top" align="left" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">Similarity (%)<hr/></td> </tr> <tr> <td valign="top" align="left" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt" scope="row">A-123<hr/></td> <td valign="top" align="center" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">68.4<hr/></td> <td valign="top" align="char" char="." style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">100<hr/></td> </tr> <tr> <td valign="top" align="left" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt" scope="row">45720<hr/></td> <td valign="top" align="center" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">70.1<hr/></td> <td valign="top" align="char" char="." style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">90.3<hr/></td> </tr> <tr> <td valign="top" align="left" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt" scope="row">NCIMB 2053</td> <td valign="top" align="center" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">54.0</td> <td valign="top" align="char" char="." style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">8.1</td> </tr> </tbody></table>
The cells in column 1 have the attribute align="left" and those in column 2 have align="center". The cells in column 3 have the attribute align="char" (i.e. align on a specific character), and they have the additional attribute char="." (i.e. align on the period, used here as a decimal point).
The JATS and NLM Book DTDs support table cell contents aligned on other characters, for example the plus/minus sign in a column of means±errors (i.e. other values of the char attribute are allowed, such as char="±"). However, Word supports alignment only on the first non-letter, non-digit character.
Note that the XML has also inherited the vertical cell alignment set in Word (valign="top"). CSS attributes for table borders and shading are also included in the XML. These can be seen in the previous example as the contents of the style attribute of the <td> element.
Shading
If shading is used in a table, as in this example:
the shading is represented as shown in the following XML when exporting with XHTML tables (to save space, the XML in this example represents the second row of the table only):
tr> <td valign="top" align="left" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 1.50pt" scope="row">φ<sub>m </sub>(for η<sub>high</sub>)</td> <td valign="top" align="center" style="border-left: solid 1.50pt; border-top: solid 1.50pt; border-right: solid 1.50pt; border-bottom: solid 1.50pt; background-color:rgb(217,217,217)">2.10<hr/></td> <td valign="top" align="center" style="border-left: solid 1.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 1.50pt">2.10<hr/></td> </tr>
Tables and Column Widths
Table width can be represented in the XML using processing instructions (see Typefi Tags section) or as an absolute measurement. eXtyles can detect the absolute width of the table as it appears in Word and pass through the width to the XML export in whatever unit fits your workflow needs (e.g., inches, centimeters, points, etc.). Column widths can be calculated as percentages of the total width of the table or as absolute units of measurement.
eXtyles can also detect the orientation of a table and pass the orientation to the XML; if a table is on a landscape page in Word, the orientation attribute of the table is automatically set to “landscape” in the XML.
The following example illustrates a landscape table whose width is represented in as an absolute width in points and whose column widths are represented as percentages:
<table-wrap id="tab_a" orientation="landscape" position="float"> <table width="179"> <col width="55.94%"/> <col width="22.03%"/> <col width="22.03%"/> <thead> <tr> <th valign="top" align="justify" scope="col" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">r(Y)</th> <th valign="top" align="justify" scope="col" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">Y2</th> <th valign="top" align="justify" scope="col" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">Y</th> </tr> </thead> <tbody> <tr> <td valign="top" align="justify" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt" scope="row">ϕm (for ηhigh)</td> <td valign="top" align="justify" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">2.10</td> <td valign="top" align="justify" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">2.10</td> </tr> <tr> <td valign="top" align="justify" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt" scope="row">ϕ (for ηlimit)</td> <td valign="top" align="justify" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">20.5</td> <td valign="top" align="justify" style="border-left: solid 0.50pt; border-top: solid 0.50pt; border-right: solid 0.50pt; border-bottom: solid 0.50pt">21.0</td> </tr> </tbody></table></table-wrap>
Note that the column widths can be omitted from the output XML.
Cell Indents
If a paragraph indent is used within a table cell, it is reflected in the XML on export; this allows great control over the arrangement of the table cell contents. Exactly how the indent is represented depends on your configuration. In the following table, the cell contents have been aligned using a first-line indent of 0.5 cm. In this configuration, the paragraph indent is represented in the output XML by a variable number of non-breaking spaces (one for every 0.1 cm):
This example is represented by the following XML, exported in CALS format:
<table frame="topbot"> <tgroup cols="3"> <colspec colnum="1" colname="col1" colwidth="146"/> <colspec colnum="2" colname="col2" colwidth="129"/> <colspec colnum="3" colname="col3" colwidth="129"/> <tbody> <row> <entry valign="bottom" rowsep="1" align="center" colsep="0">r(Y)</entry> <entry valign="bottom" rowsep="1" align="center" colsep="0">Y<sup>2</sup></entry> <entry valign="bottom" rowsep="1" align="center" colsep="0">Y</entry> </row> <row> <entry valign="middle" align="left" colsep="0" rowsep="0">φ<sub>m</sub> (for η<sub>high</sub>)</entry> <entry valign="middle" align="left" colsep="0" rowsep="0"> 2.10</entry><entry valign="middle" align="left" colsep="0" rowsep="0"> 2.10</entry> </row> <row> <entry valign="middle" align="left" colsep="0" rowsep="0">φ (for η<sub>limit</sub>)</entry> <entry valign="middle" align="left" colsep="0" rowsep="0"> 20.5</entry> <entry valign="middle" align="left" colsep="0" rowsep="0"> 21.0</entry> </row> </tbody> </tgroup> </table>
Note again that the table borders are represented in the XML file.
Contact eXtyles-support@inera.com if you have questions about the presentation of tables in your XML.
Row Headers
While row headers that appear mid-table is supported by eXtyles, the JATS DTD does not include a way to indicate that a row is a heading row when in mid-table. However, there is a "more correct" way to do this JATS. Simply style the mid-table heading rows with the Table Column Head style. This style forces a new <table> element within the <table-wrap> element. For example, the following table:
yields this XML:
<table frame="hsides" rules="groups"> <thead> <tr> <th valign="top" align="left" scope="col">Head 1</th> <th valign="top" align="left" scope="col">Head 1a</th> <th valign="top" align="left" scope="col">Head 1b</th> </tr> </thead> <tbody> <tr> <td valign="top" align="left" scope="row">Body 1</td> <td valign="top" align="left">Body 1a</td> <td valign="top" align="left">Body 1b</td> </tr> </tbody> </table> <table frame="hsides" rules="groups"> <thead> <tr> <th valign="top" align="left" scope="col">Head 2</th> <th valign="top" align="left" scope="col">Head 2a</th> <th valign="top" align="left" scope="col">Head 2b</th> </tr> </thead> <tbody> <tr> <td valign="top" align="left" scope="row">Body 2</td> <td valign="top" align="left">Body 2a</td> <td valign="top" align="left">Body 2b</td> </tr> </tbody> </table> </table-wrap>
Advanced Table Formatting
If you want to specify a row starts on a new page, highlight the row in Word, open the Paragraph Format dialog in Word, and select Page Break Before from the Line and Page Breaks tab. eXtyles then inserts a processing instruction in the XML to start a new page.
... <tbody> <tr> <td valign=”top” align=”center” style=”border-left: solid 3px; border-right: solid 1px; border-bottom: solid 1px” scope=”row”>100</td> <td valign=”top” align=”center” style=”border-left: solid 1px; border-right: solid 1px; border-bottom: solid 1px”>−10</td> <td valign=”top” align=”center” style=”border-left: solid 1px; border-right: solid 3px; border-bottom: solid 1px”>45</td> </tr> <tr><?Table Page-Break?> <td valign=”top” align=”center” style=”border-left: solid 3px; border-top: solid 1px; border-right: solid 1px; border-bottom: solid 1px” scope=”row”>125</td> <td valign=”top” align=”center” style=”border-left: solid 1px; border-top: solid 1px; border-right: solid 1px; border-bottom: solid 1px”>−11</td> <td valign=”top” align=”center” style=”border-left: solid 1px; border-top: solid 1px; border-right: solid 3px; border-bottom: solid 1px”>45</td> </tr> ...
If text is rotated in table cells, this is preserved in the XML by including a style attribute style="transform: rotate(-90deg)"
for that cell:
The above example yields the following XML:
<tbody> <tr> <td rowspan=”2” valign=”middle” align=”center” style=”border-left: solid 3px; border-top: solid 3px; border-right: solid 1px; border-bottom: solid 3px; transform: rotate(-90deg)” scope=”row”>Probing System</td> <td valign=”middle” align=”center” style=”border-left: solid 1px; border-top: solid 3px; border-right: solid 3px; border-bottom: solid 1px”>A: without arcuate error correction</td> <td valign=”middle” align=”center” style=”border-left: solid 3px; border-top: solid 3px; border-right: solid 1px; border-bottom: solid 1px”>P<italic>x</italic> o C<italic>y</italic>-A</td> <td valign=”middle” align=”center” style=”border-left: solid 1px; border-top: solid 3px; border-right: solid 1px; border-bottom: solid 1px”>P<italic>x</italic> o P<italic>y</italic>-A</td> <td valign=”middle” align=”center” style=”border-left: solid 1px; border-top: solid 3px; border-right: solid 1px; border-bottom: solid 1px”>C<italic>x</italic> o C<italic>y</italic>-A</td> <td valign=”middle” align=”center” style=”border-left: solid 1px; border-top: solid 3px; border-right: solid 1px; border-bottom: solid 1px”>P<italic>xy</italic>-A</td> <td valign=”middle” align=”center” style=”border-left: solid 1px; border-top: solid 3px; border-right: solid 3px; border-bottom: solid 1px”>C<italic>xy</italic>-A</td> </tr> ...
Contact eXtyles-support@inera.com if you have questions about the presentation of tables in your XML.
Table and Box Location in the Word file
Numbered tables and boxes may be located in the Word file either at the end of the file, or just after the paragraph where the item is first cited. In either situation, eXtyles will correctly place the table or box in the XML file as set up in your configuration.
In the case of unnumbered and/or uncited tables and boxes, the table or box must be placed in the Word file just after the paragraph where it should appear in the PDF file or HTML page.