【问题标题】:XSL-FO table centerXSL-FO 工作台中心
【发布时间】:2012-08-25 04:33:30
【问题描述】:

目前我正在使用 XSL-FO 来生成 PDF 文件。事实上,我是直接编写 FO 对象,而不是分离 XML 和 XSL。这是我们目前的要求。我们能够正确对齐文本。但是,当我们制作表格时,将其保持在中心不会显示完整的表格。可能是什么问题呢。我在这里发布我尝试过的代码:

<fo:block>
            <fo:table width="80%"
                border-style="solid"
                border-width="1pt"
                border-color="#69468D"
                table-layout="fixed"
                space-before="10px"
                space-after="10px"
                text-align="start">
                <fo:table-header line-height="10pt"
                    font-size="6pt"
                    background-color="#69468D"
                    color="white"
                    padding-top="3pt">
                    <fo:table-row>
                        <fo:table-cell border-top-color="solid pruple" border-left-color="solid pruple" border="1pt solid white">
                            <fo:block>text</fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="0.5pt solid pruple" padding="4pt">
                            <fo:block>text</fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="0.5pt solid pruple" padding="4pt">
                            <fo:block>text</fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="0.5pt solid pruple" padding="4pt">
                            <fo:block>text</fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="0.5pt solid pruple" padding="4pt">
                            <fo:block>text</fo:block>
                        </fo:table-cell>
                        <fo:table-cell border="0.5pt solid pruple" padding="4pt">
                            <fo:block>Text</fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </fo:table-header>
                <fo:table-body line-height="5pt"
                    font-size="6pt">
                    <fo:table-row padding-top="3pt">
                        <fo:table-cell text-align="center">
                            <fo:block> 
                                hi
                            </fo:block>
                        </fo:table-cell>
                        <fo:table-cell text-align="center">
                            <fo:block> 
                            hi
                            </fo:block>
                        </fo:table-cell>
                    </fo:table-row>
                </fo:table-body>
            </fo:table>
        </fo:block>

【问题讨论】:

    标签: xsl-fo apache-fop


    【解决方案1】:

    我相信解决方案是绝对测量而不是百分比。

    【讨论】:

      【解决方案2】:

      如果我们有五列,那么我们可以如下居中表格

      <fo:table width="100%">
          <fo:table-column column-width="20%"/>
          <fo:table-column column-width="20%"/>
          <fo:table-column column-width="20%"/>
          <fo:table-column column-width="20%"/>
          <fo:table-column column-width="20%"/>
      </fo:table>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-05-12
        • 2011-05-01
        • 2014-11-26
        • 2019-04-11
        • 1970-01-01
        • 2015-12-22
        • 2015-06-14
        • 1970-01-01
        相关资源
        最近更新 更多