Erik B. wrote:

We have an issue with sizing table columns when generating a PDF.
We use the colgroup width attribute to set the size.

colgroup implies that you are using HTML tables in your DocBook document, which is fine, except...see below.



In the XMLMind Editor the columns appear in the size we want.
However when generating a PDF all columns are the same size.
Any ideas on how to solve this?


Yes. You need to use CALS tables in your DocBook document, not HTML tables.

The standard DocBook XSL stylesheets (not the work of XMLmind) which are used to generate the XSL-FO which is then converted to PDF, seem to not fully support HTML tables, hence the issue you report. On the other hand, DocBook XSL stylesheets seem to fully support CALS tables.

Attached sample files shows you the difference between the two kinds of tables.


<?xml version="1.0" encoding="UTF-8"?>
<section version="5.0" xmlns="http://docbook.org/ns/docbook";
         xmlns:xlink="http://www.w3.org/1999/xlink";
         xmlns:xi="http://www.w3.org/2001/XInclude";
         xmlns:svg="http://www.w3.org/2000/svg";
         xmlns:m="http://www.w3.org/1998/Math/MathML";
         xmlns:html="http://www.w3.org/1999/xhtml";
         xmlns:db="http://docbook.org/ns/docbook";>
  <title>Test table column widths</title>

  <para>This is a CALS table.</para>

  <table>
    <title>CALS table</title>

    <tgroup cols="2">
      <colspec colwidth="190*"/>

      <colspec colwidth="810*"/>

      <thead>
        <row>
          <entry align="center">H1,1</entry>

          <entry align="center">H1,2</entry>
        </row>
      </thead>

      <tbody>
        <row>
          <entry>C1,1</entry>

          <entry>C1,2</entry>
        </row>

        <row>
          <entry>C2,1</entry>

          <entry>C2,2</entry>
        </row>
      </tbody>
    </tgroup>
  </table>

  <para>This is an HTML table.</para>

  <table frame="box" rules="all">
    <caption>HTML table</caption>

    <colgroup width="19%"/>

    <colgroup width="81%"/>

    <thead>
      <tr align="center">
        <th>H1,1</th>

        <th>H1,2</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>C1,1</td>

        <td>C1,2</td>
      </tr>

      <tr>
        <td>C2,1</td>

        <td>C2,2</td>
      </tr>
    </tbody>
  </table>
</section>

Attachment: TableCols.pdf
Description: Adobe PDF document

--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to