【发布时间】:2014-08-26 18:28:23
【问题描述】:
正如标题所说,我在使用 JasperReports 的报告可视化方面遇到了问题。首先,我使用 Eclipse Indigo 和插件 Jaspersoft Studio 来创建报告和 JDK 1.6 U24。
以下代码将帮助我解释我的问题
<textField pattern="dd/MM/yyyy" isBlankWhenNull="true">
<reportElement positionType="Float" mode="Transparent" x="131" y="79" width="423" height="12" isRemoveLineWhenBlank="true" backcolor="#E1E9F0" uuid="9075f7aa-bd0f-4e78-8eca-102cc38f6f37"/>
<textElement verticalAlignment="Middle">
<font fontName="Serif" size="9" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{inscriptionDate}]]></textFieldExpression>
</textField>
问题是在显示报表时会忽略标签texField和textElement的属性,即当变量“inscriptionDate”(为Date类型时)会忽略textField标签的属性“pattern” ) 显示在报告中。再比如textElement标签的font子标签的“size”和“fontName”属性,和textField一样,这个属性会被忽略,文本会以默认属性显示。
在“大小”属性的特定情况下,我尝试更改值,但总是得到相同的结果。有趣的是,“isBold”或“isItalic”属性并没有被忽略。
同样的问题发生在 staticText 标签上:
<staticText>
<reportElement style="titulo2" positionType="Float" mode="Transparent" x="1" y="95" width="553" height="12" backcolor="#E1E9F0" uuid="09fb4cfe-831d-42f3-a32c-66ce4a2bc0f0">
<printWhenExpression><![CDATA[true]]></printWhenExpression>
</reportElement>
<textElement verticalAlignment="Middle" markup="styled">
<font fontName="Serif" size="9" isBold="true" isItalic="true"/>
</textElement>
<text><![CDATA[<style size="9">Some text</style>]]></text>
</staticText>
第一个代码和第二个代码的区别在于标签<style>的使用(倒数第二行),实际上,我正在使用这个“解决方案”来尝试解决我的问题但我知道这是不是一个合适的解决方案。
非常感谢您的帮助...
【问题讨论】:
标签: jasper-reports