我想在每个页面中创建一个带有页眉和页脚的PDF文档,我不知道为什么它们只出现在奇数页面中.
我简化了代码,我创建了一个表,我重复了几次有4页,但结果是一样的,页眉和页脚只出现在第一页和第三页.
这是代码.xsl版本是1.0.
<xsl:output indent="yes"/>
<xsl:template match ="template">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<!-- layout information -->
<fo:simple-page-master master-name="pagetemplate"
page-height="29.7cm"
page-width="21cm"
margin-top="1cm"
margin-bottom="0.1cm"
margin-left="0.8cm"
margin-right="1.0cm">
<fo:region-body margin-top="2.5cm" margin-bottom="2.5cm"/>
<fo:region-before extent="2.0cm"/>
<fo:region-after extent="2.0cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="pagetemplate">
<fo:static-content flow-name="xsl-region-before">
<fo:block>
<xsl:call-template name="header"/>
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after">
<fo:block>
<xsl:call-template name="footer"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body">
<xsl:call-template name="block"/>
<xsl:call-template name="block"/>
<xsl:call-template name="block"/>
<xsl:call-template name="block"/>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
Run Code Online (Sandbox Code Playgroud) 我正在编写一个应用程序来将数据导出到Excel工作表.
我不会使用XSSFWorkbook类,因为我的Excel超过了HSSFWorkbook类的255列限制.
我下载了Apache POI库,并将以下库包含在我的proyect中: - poi-3.9.jar - poi-excelant-3.9.jar - poi-ooxml-3.9.jar - poi-ooxml-schemas-3.9.jar - poi -scratchpad-3.9.jar - dom4j-1.6.1.jar - stax-api-1.0.1.jar - xmlbeans-2.3.0.jar
当我导出数据以获取Excel工作表时,我得到此运行时错误:
java.lang.ExceptionInInitializerError
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918)
at java.lang.reflect.Field.getFieldAccessor(Field.java:899)
Truncated. see log file for complete stacktrace
Caused By: java.lang.RuntimeException: Could not instantiate SchemaTypeSystemImpl (java.lang.reflect.InvocationTargetException): is the version of xbean.jar correct?
at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.loadTypeSystem(Unknown Source)
at schemaorg_apache_xmlbeans.system.sE130CAA0A01A7CDE5A2B4FEB8B311707.TypeSystemHolder.<clinit>(Unknown Source)
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
Truncated. see log file for complete stacktrace
Caused By: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native …Run Code Online (Sandbox Code Playgroud)