在 JAVA 中使用 XSL 生成 PDF 时出现问题。 类 org.apache.fop.fo.flow.TableAndCaption 没有 LayoutManager 生成器

发布于 2024-07-20 07:12:01 字数 3323 浏览 4 评论 0原文

在 JAVA 中使用 XSL 生成 PDF 时遇到问题。 总是得到“No LayoutManagermaker for class org.apache.fop.fo.flow.TableAndCaption”。 这是 XSL 源代码:

<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
    <xsl:output method="xml" version="2.0" media-type="application/xslfo+xml" indent="yes" encoding="Windows-1251"/>
    <xsl:template match="RootPart">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="allPages" page-height="297mm" page-width="210mm" margin-top="5mm" margin-bottom="5mm" margin-left="20mm" margin-right="5mm">
                    <fo:region-body margin-top="5mm"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence font-family="arial" font-size="9pt" font-weight="normal" master-reference="allPages">             
                <fo:flow flow-name="xsl-region-body">
                    <fo:table-and-caption table-layout="fixed" >    
                        <fo:table border-style="solid" border-width="0.3mm" border-color="black">
                            <fo:table-column column-width="97mm"/>
                            <fo:table-column column-width="97mm"/>
                            <fo:table-header>
                                <fo:table-cell>
                                    <fo:block>TEST1</fo:block>
                                </fo:table-cell>
                                <fo:table-cell>
                                    <fo:block>TEST2</fo:block>
                                </fo:table-cell>
                            </fo:table-header>
                            <fo:table-body>
                                <fo:table-row height = "5mm">
                                        <fo:table-cell>
                                        <fo:block>Volvo</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell>
                                        <fo:block>$50000</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block>SAAB</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell>
                                        <fo:block>$48000</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>
                    </fo:table-and-caption>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>

Got a problem using XSL to produce PDF in JAVA.
Always get "No LayoutManager maker for class class org.apache.fop.fo.flow.TableAndCaption".
Here's the XSL source:

<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet version="1.1" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" exclude-result-prefixes="fo">
    <xsl:output method="xml" version="2.0" media-type="application/xslfo+xml" indent="yes" encoding="Windows-1251"/>
    <xsl:template match="RootPart">
        <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
            <fo:layout-master-set>
                <fo:simple-page-master master-name="allPages" page-height="297mm" page-width="210mm" margin-top="5mm" margin-bottom="5mm" margin-left="20mm" margin-right="5mm">
                    <fo:region-body margin-top="5mm"/>
                </fo:simple-page-master>
            </fo:layout-master-set>
            <fo:page-sequence font-family="arial" font-size="9pt" font-weight="normal" master-reference="allPages">             
                <fo:flow flow-name="xsl-region-body">
                    <fo:table-and-caption table-layout="fixed" >    
                        <fo:table border-style="solid" border-width="0.3mm" border-color="black">
                            <fo:table-column column-width="97mm"/>
                            <fo:table-column column-width="97mm"/>
                            <fo:table-header>
                                <fo:table-cell>
                                    <fo:block>TEST1</fo:block>
                                </fo:table-cell>
                                <fo:table-cell>
                                    <fo:block>TEST2</fo:block>
                                </fo:table-cell>
                            </fo:table-header>
                            <fo:table-body>
                                <fo:table-row height = "5mm">
                                        <fo:table-cell>
                                        <fo:block>Volvo</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell>
                                        <fo:block>$50000</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell>
                                        <fo:block>SAAB</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell>
                                        <fo:block>$48000</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>
                    </fo:table-and-caption>
                </fo:flow>
            </fo:page-sequence>
        </fo:root>
    </xsl:template>
</xsl:stylesheet>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与之呼应 2024-07-27 07:12:01

Apache FOP 尚不支持 fo:table-and-caption。 只需删除该元素并直接使用 fo:table 即可。

另请参阅:http://xmlgraphics.apache.org /fop/compliance.html#fo-object-table-and-caption

Apache FOP doesn't support fo:table-and-caption, yet. Just remove the element and use fo:table directly.

See also: http://xmlgraphics.apache.org/fop/compliance.html#fo-object-table-and-caption

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文