简体   繁体   English

子报表文本字段对齐方式和字体在我通过Java代码运行时在jasper报表中不起作用,因为它在预览模式下可以正常工作

[英]sub report text field alignment & font not working in jasper report when I run it via java code, where as it works fine in preview mode

I have main report & one subreport (I have used sub report in main reports title band), I have set some alignment & fonts for some of the text fields & static text fields. 我有主报告和一个子报告(我在主报告标题栏中使用了子报告),我为某些文本字段和静态文本字段设置了一些对齐方式和字体。 When I run it via Jasper reports Preview mode it works fine, even export is proper if I export it via preview mode. 当我通过Jasper Reports预览模式运行它时,它可以正常工作,如果我通过预览模式导出它,则即使导出也是正确的。

But when I am running same .jrxml (main & sub report .jrxml) via java code, the content of main report are getting displayed proper as I want, but only the contents of sub report are not proper aligned. 但是,当我通过Java代码运行相同的.jrxml(主报表和子报表.jrxml)时,主报表的内容会根据我的需要正确显示,但是只有子报表的内容未正确对齐。

Please let me know the answers, thanks in advance. 请让我知道答案,在此先感谢。

Here is the sub report xml code: 这是子报告xml代码:

<title>
        <band height="92" splitType="Stretch">
            <subreport>
                <reportElement x="0" y="1" width="1980" height="89" isPrintInFirstWholeBand="true" uuid="a3d62877-7e70-4ea0-8d6b-0f658e37a78d"/>
                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource ($P{exitMethodReport_SubReportDatasource}.getData())]]></dataSourceExpression>
                <subreportExpression><![CDATA["exit_method_subreport.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </title>

This usually happens when you have a different (probably older) version of the Jasper library at runtime than the one you used to compile the .jrxml file; 当您在运行时使用的Jasper库版本不同于(用于编译.jrxml文件的)版本时,通常会发生这种情况。 resulting in markup elements in your .jasper file that the Jasper runtime doesn't understand. 导致Jasper运行时无法理解的.jasper文件中的标记元素。

You should either update your runtime library (recommended) or compile the report to the correct version in iReport. 您应该更新您的运行时库(推荐)或在iReport中将报告编译为正确的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM