代码之家  ›  专栏  ›  技术社区  ›  joycollector

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

  •  1
  • joycollector  · 技术社区  · 17 年前

    在JAVA中使用XSL生成PDF时遇到问题。 始终获取“类org.apache.fop.fo.flow.TableAndCaption没有LayoutManager生成器”。

    <?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>
    
    1 回复  |  直到 17 年前
        1
  •  4
  •   Jeremias Märki    17 年前

    apachefop还不支持fo:table和caption。只需删除元素并直接使用fo:table。

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

    推荐文章