【问题标题】:Excel not well formated in JasperReportsJasperReports 中的 Excel 格式不正确
【发布时间】:2013-04-17 18:51:50
【问题描述】:

当我将报告导出到 Excel 时,如果单元格中显示多于一行,则单元格不会显示整个文本;它只是削减了一部分,我需要手动扩展该行以查看其中的所有数据

我使用以下格式:

<band height="21">
            <staticText>
                <reportElement style="pageHeader" mode="Opaque" x="0" y="6" width="88" height="15"/>
                <textElement textAlignment="Left">
                    <font fontName="Cambria" size="10"/>
                </textElement>
                <text><![CDATA[First Name]]></text>
            </staticText>
</band>

 <band height="30" splitType="Prevent">
            <textField isStretchWithOverflow="true">
                <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="88" height="25"/>
                <textElement textAlignment="Left">
                    <font fontName="Cambria" size="10"/>
                </textElement>
                <textFieldExpression class="java.lang.String"><![CDATA[$F{firstName}]]></textFieldExpression>
            </textField>
</band>

我应该设置 xls 属性吗?

【问题讨论】:

  • 你用的是什么版本的JR?你能发布你的报告设计的截图(在iReport中)吗?
  • 我一直遇到同样的问题,但只是假设用户需要根据自己的喜好格式化 Excel。有兴趣看看你是否能得到更好的答案。
  • 您使用的是JRXlsExporter 还是JRXlsxExporter?也许交换一下,看看有没有什么不同?

标签: excel jasper-reports format


【解决方案1】:

我解决了在文本字段属性菜单中将行距设置为双倍的问题。

看起来没有什么不同,但显示的是全文。

【讨论】:

  • 我试过行间距“1_1_2”,看起来还不错。似乎 Excel 默认使用此行距,但 jasper 使用“Single”计算。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-19
  • 1970-01-01
相关资源
最近更新 更多