【发布时间】:2015-05-07 16:39:08
【问题描述】:
我在 jasper 报告中有一个表格,我需要该表格中某些单元格的内容垂直对齐。我正在尝试使用 iReport 编辑报告。
在 iReport 中,我可以进入单元格的属性并看到垂直对齐设置为“中间”。此外,当我直接查看 XML 时(见下文),我可以看到 textElement 标记有一个 verticalAlignment="Middle" 属性。
据我所知,文本应该在它的小盒子内垂直对齐,但它不会正确对齐。
我希望有在 jasper 报告中垂直对齐事物经验的人可以指出我做错了什么。非常感谢。
<textField
isStretchWithOverflow="false"
isBlankWhenNull="true"
evaluationTime="Now"
hyperlinkType="None"
hyperlinkTarget="Self" >
<reportElement
x="227"
y="0"
width="31"
height="14"
key="textField-4"/>
<box>
<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="0.0" lineColor="#000000"/>
<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" pdfFontName="Times-Roman" size="8"/>
</textElement>
<textFieldExpression class="java.lang.String"><![CDATA[$F{someVariableName}]]></textFieldExpression>
</textField>
所以,明确地说,我的报告中的内容是这样的:
|--------|
| text |
| |
| |
|--------|
而我想要是这样的:
|--------|
| |
| text |
| |
|--------|
【问题讨论】:
-
我发现张贴前图和后图很有帮助。之前的图像显示了报告当前的显示方式。后图显示了您希望报告的显示方式。
-
我真的没有地方可以发布图片,但为了清楚起见,我会添加一些图表。
-
龙虾 - 您使用的是哪个版本的 iReport?因为iReport有能力改变一些Tags,需要每次都检查。
标签: jasper-reports