目前,我正在开发用于生成PDF文件的XSL-FO。实际上,我是直接编写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>发布于 2014-03-26 16:59:31
我认为解决方案应该是绝对测量而不是百分比。
发布于 2018-03-20 15:09:05
如果我们有五列,那么我们可以将表居中,如下所示
<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>https://stackoverflow.com/questions/12119172
复制相似问题