← Prev in month
← Prev in thread
Setting HTML Colwidths
Hiya
I'm working on a method of importing HTML into a Word document and have come across a problem with importing a table.
Given a Docbook table of the form:
<table>
<tgroup>
<colspec colnum="1" colname="col1" colwidth="30pt"/>
<colspec colnum="2" colname="col2" colwidth="150pt"/>
<tbody>
<row>
<entry colname="col1"><para>MyFirstCol</para></entry>
<entry colname="col2"><para>My2ndCol</para></entry>
</row>
</tbody>
</tgroup>
</table>
Using the XHTML Stylesheets with my own customisation layers (with no table customisations yet) gives:
<table>
<colgroup>
<col width="30pt" align="left">
<col width="150pt" align="left">
</colgroup>
<tbody>
<tr valign="top">
<td valign="top"><p>MyFirstCol</p></td>
<td valign="top"><p>My2ndCol</p></td>
</tr>
</tbody>
</table>
Viewing with a Browser works fine as you'd expect and even opening in Word gives the impression that it's fine too. However the problem is that Word doesn't fix the Column widths - adding more text to "col1" for example, stretches the column width to suite the new text.
It seems I can force Word to harden the column widths by setting a style attribute on every <td> and <th> (eg: <td valign="top" style="width:30.0pt;">).
Can anyone help with the XSLT required to do this? I'm having difficulty understanding how I can track which <entry> I'm processing and therefore which colspec.colwidth I need...
Cheers
Phil
← Prev in month
← Prev in thread