XSL-FO 表中心 [英] XSL-FO table center

查看:35
本文介绍了XSL-FO 表中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

currently I am working on the XSL-FO for generating the PDF files. Infact I am directly writing the FO object instead of separating the XML and XSL. That is our requirement currently. We are able to align the text properly. But, when we are making the table, while keeping it in center not showing the complete table. What could be the problem. Here I am posting the code I have tried:

<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>

推荐答案

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

If we have five columns then we can center table as follows

<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>

这篇关于XSL-FO 表中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆