最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】docbook5中指定表格table中列column的宽度

Docbook crifan 2970浏览 0评论

【问题】

docbook中,已经实现了表格显示:

    <table>
    <title id="mpeg.header_format">MPEG音频的帧头的格式</title>
    <tgroup cols="4">
        <thead>
            <row><entry>位置(bit)</entry><entry>长度(bit)</entry><entry>含义</entry><entry>示例</entry></row>
        </thead>
        
        <tbody>
            <row><entry>0</entry><entry>11</entry><entry>用于同步帧,找到此帧头(所有位均置1)</entry><entry>1111 1111 111</entry></row>
            <row><entry>11</entry><entry>2</entry><entry>MPEG音频的版本ID</entry><entry>11</entry></row>
            <row><entry>13</entry><entry>2</entry><entry>Layer 的索引</entry><entry>01</entry></row>
            <row><entry>15</entry><entry>1</entry><entry>保护位:<literallayout>0 – 用16位的CRC保护下面的帧头
1 – 无CRC</literallayout></entry><entry>1</entry></row>
            <row><entry>16</entry><entry>4</entry><entry>比特率索引 (见下表)</entry><entry>1001</entry></row>
            <row><entry>20</entry><entry>2</entry><entry>采样率索引 (见下表)</entry><entry>11</entry></row>
            <row><entry>22</entry><entry>1</entry><entry>填充位。如果设置了此位,就会对每帧数据填充一个slot (对于帧大小的计算很重要)</entry><entry>0</entry></row>
            <row><entry>23</entry><entry>1</entry><entry>私有位 (仅用于标示性的)</entry><entry>1</entry></row>
            <row><entry>24</entry><entry>2</entry><entry>声道的模式 </entry><entry>01</entry></row>
            <row><entry>26</entry><entry>2</entry><entry>模式扩展 (仅用于联合立体声) (注:此处不是本文重点,故忽略相关的索引表)</entry><entry>00</entry></row>
      </tbody>
    </tgroup>
    </table>

但是编译有warning:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/src/docbook/books/VBR/src

$ E:/Dev_Root/docbook/config/tool/fop/fop-1.0/fop.cmd -c E:/Dev_Root/docbook/config/tool/fop/fop-1.0/conf/fop.xconf E:/Dev_Root/docbook/dev/src/docbook/books/VBR/output/fo/MPEG_VBR.fo -pdf E:/Dev_Root/docbook/dev/src/docbook/books/VBR/output/pdf/MPEG_VBR.pdf

四月 30, 2012 1:46:34 下午 org.apache.fop.apps.FopFactoryConfigurator configure

信息: Default page-height set to: 11in

四月 30, 2012 1:46:34 下午 org.apache.fop.apps.FopFactoryConfigurator configure

信息: Default page-width set to: 8.26in

四月 30, 2012 1:46:35 下午 org.apache.fop.events.LoggingEventListener processEvent

警告: Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".

四月 30, 2012 1:46:35 下午 org.apache.fop.events.LoggingEventListener processEvent

警告: Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400".

四月 30, 2012 1:46:35 下午 org.apache.fop.hyphenation.Hyphenator getHyphenationTree

严重: Couldn’t find hyphenation pattern zh_cn

四月 30, 2012 1:46:36 下午 org.apache.fop.events.LoggingEventListener processEvent

警告: The following feature isn’t implemented by Apache FOP, yet: table-layout="auto" (on fo:table) (See position 10:21223)

四月 30, 2012 1:46:36 下午 org.apache.fop.events.LoggingEventListener processEvent

严重: Invalid property value encountered in column-width="proportional-column-width(1)": org.apache.fop.fo.expr.PropertyException: file:/E:/Dev_Root/docbook/dev/src/docbook/books/VBR/output/fo/MPEG_VBR.fo:10:21223: proportional-column-width() function may only be used when fo:table has table-layout="fixed".; property:’column-width’ (See position 10:21303)

四月 30, 2012 1:46:36 下午 org.apache.fop.events.LoggingEventListener processEvent

严重: Invalid property value encountered in column-width="proportional-column-width(1)": org.apache.fop.fo.expr.PropertyException: file:/E:/Dev_Root/docbook/dev/src/docbook/books/VBR/output/fo/MPEG_VBR.fo:10:21223: proportional-column-width() function may only be used when fo:table has table-layout="fixed".; property:’column-width’ (See position 10:21383)

四月 30, 2012 1:46:36 下午 org.apache.fop.events.LoggingEventListener processEvent

严重: Invalid property value encountered in column-width="proportional-column-width(1)": org.apache.fop.fo.expr.PropertyException: file:/E:/Dev_Root/docbook/dev/src/docbook/books/VBR/output/fo/MPEG_VBR.fo:10:21223: proportional-column-width() function may only be used when fo:table has table-layout="fixed".; property:’column-width’ (See position 10:21463)

四月 30, 2012 1:46:36 下午 org.apache.fop.events.LoggingEventListener processEvent

严重: Invalid property value encountered in column-width="proportional-column-width(1)": org.apache.fop.fo.expr.PropertyException: file:/E:/Dev_Root/docbook/dev/src/docbook/books/VBR/output/fo/MPEG_VBR.fo:10:21223: proportional-column-width() function may only be used when fo:table has table-layout="fixed".; property:’column-width’ (See position 10:21543)

四月 30, 2012 1:46:36 下午 org.apache.fop.events.LoggingEventListener processEvent

警告: Line 1 of a paragraph overflows the available area by 48110 millipoints. (See position 10:27585)

且编译出来的效果也难看:

bad column width

现在想要根据自己的需要,去设置不同的列,不同的宽度。

【解决过程】

1.参考:Column widths,添加了对应代码:

    <table>
    <title id="mpeg.header_format">MPEG音频的帧头的格式</title>
    <tgroup cols="4">
    <colspec colnum="1" colname="col1" colwidth="1*"/>
    <colspec colnum="2" colname="col2" colwidth="1*"/>
    <colspec colnum="3" colname="col3" colwidth="6*"/>
    <colspec colnum="4" colname="col4" colwidth="2*"/>

        <thead>
            <row><entry>位置(bit)</entry><entry>长度(bit)</entry><entry>含义</entry><entry>示例</entry></row>
        </thead>
        
        <tbody>
            <row><entry>0</entry><entry>11</entry><entry>用于同步帧,找到此帧头(所有位均置1)</entry><entry>1111 1111 111</entry></row>
            <row><entry>11</entry><entry>2</entry><entry>MPEG音频的版本ID</entry><entry>11</entry></row>
            <row><entry>13</entry><entry>2</entry><entry>Layer 的索引</entry><entry>01</entry></row>
            <row><entry>15</entry><entry>1</entry><entry>保护位:<literallayout>0 – 用16位的CRC保护下面的帧头
1 – 无CRC</literallayout></entry><entry>1</entry></row>
            <row><entry>16</entry><entry>4</entry><entry>比特率索引 (见下表)</entry><entry>1001</entry></row>
            <row><entry>20</entry><entry>2</entry><entry>采样率索引 (见下表)</entry><entry>11</entry></row>
            <row><entry>22</entry><entry>1</entry><entry>填充位。如果设置了此位,就会对每帧数据填充一个slot (对于帧大小的计算很重要)</entry><entry>0</entry></row>
            <row><entry>23</entry><entry>1</entry><entry>私有位 (仅用于标示性的)</entry><entry>1</entry></row>
            <row><entry>24</entry><entry>2</entry><entry>声道的模式 </entry><entry>01</entry></row>
            <row><entry>26</entry><entry>2</entry><entry>模式扩展 (仅用于联合立体声) (注:此处不是本文重点,故忽略相关的索引表)</entry><entry>00</entry></row>
      </tbody>
    </tgroup>
    </table>

然后编译时,也没了warning了:

Administrator@K470 /cygdrive/e/Dev_Root/docbook/dev/src/docbook/books/VBR/src

$ E:/Dev_Root/docbook/config/tool/fop/fop-1.0/fop.cmd -c E:/Dev_Root/docbook/config/tool/fop/fop-1.0/conf/fop.xconf E:/Dev_Root/docbook/dev/src/docbook/books/VBR/output/fo/MPEG_VBR.fo -pdf E:/Dev_Root/docbook/dev/src/docbook/books/VBR/output/pdf/MPEG_VBR.pdf

四月 30, 2012 2:02:12 下午 org.apache.fop.apps.FopFactoryConfigurator configure

信息: Default page-height set to: 11in

四月 30, 2012 2:02:12 下午 org.apache.fop.apps.FopFactoryConfigurator configure

信息: Default page-width set to: 8.26in

四月 30, 2012 2:02:13 下午 org.apache.fop.events.LoggingEventListener processEvent

警告: Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".

四月 30, 2012 2:02:13 下午 org.apache.fop.events.LoggingEventListener processEvent

警告: Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400".

四月 30, 2012 2:02:13 下午 org.apache.fop.hyphenation.Hyphenator getHyphenationTree

严重: Couldn’t find hyphenation pattern zh_cn

结果出来的表格的宽度,也好看了:

good width

【总结】

在table的tgroup之后,添加对应的colspec,指定对应的colwidth,即可达到自定义表格中列的宽度。

转载请注明:在路上 » 【已解决】docbook5中指定表格table中列column的宽度

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.199 seconds, using 22.14MB memory