Configuring a Table Column Width Provider
table element as well as the table columns
can have specified widths. For these widths to be considered by Author
mode we need to provide the means to determine them. As explained in the Configuring Tables, if you use the
table element attribute width
Oxygen XML Editor can determine the table width automatically. In this example the table
has col elements with width attributes that are not recognized by
default. You will need to implement a Java extension class to determine the column
widths.In the listing below, the XML document contains the table element:
<table width="300"> <customcol width="50.0px"/> <customcol width="1*"/> <customcol width="2*"/> <customcol width="20%"/> <header> <td>C1</td> <td>C2</td> <td>C3</td> <td>C4</td> </header> <tr> <td>cs=1, rs=1</td> <td>cs=1, rs=1</td> <td row_span="2">cs=1, rs=2</td> <td row_span="3">cs=1, rs=3</td> </tr> <tr> <td>cs=1, rs=1</td> <td>cs=1, rs=1</td> </tr> <tr> <td column_span="3">cs=3, rs=1</td> </tr> </table>
When no table column width provider is specified, the table has the following layout:
Figure: Table layout when no column width provider is specified
When the above implementation is configured, the table has the correct layout:
Figure: Columns with custom widths
Note: The complete source code for the examples can be found in the Simple
Documentation Framework project, included in the oxygen-sample-framework module of the
Oxygen SDK , available as a Maven archetype on the Oxygen XML Editor website.