在 JAVA 中使用 XSL 生成 PDF 时出现问题。 类 org.apache.fop.fo.flow.TableAndCaption 没有 LayoutManager 生成器
在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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