Jasper reports jasper报告中的垂直文本对齐
我在jasper报表中有一个表,我需要该表中某些单元格的内容垂直对齐。我正在尝试使用iReport编辑报表 在iReport中,我可以进入单元格的属性,看到垂直对齐设置为“中间”。此外,当我直接查看XML时(见下文),我可以看到textElement标记有一个verticalAlignment=“Middle”属性。 尽我所知,文本应该在其小框内垂直对齐,但它不会正确对齐。 我希望在jasper reports中有经验的人能够指出我做错了什么。非常感谢Jasper reports jasper报告中的垂直文本对齐,jasper-reports,Jasper Reports,我在jasper报表中有一个表,我需要该表中某些单元格的内容垂直对齐。我正在尝试使用iReport编辑报表 在iReport中,我可以进入单元格的属性,看到垂直对齐设置为“中间”。此外,当我直接查看XML时(见下文),我可以看到textElement标记有一个verticalAlignment=“Middle”属性。 尽我所知,文本应该在其小框内垂直对齐,但它不会正确对齐。 我希望在jasper reports中有经验的人能够指出我做错了什么。非常感谢 <textField isSt
<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 |
| |
|--------|
您可以1)检查positionType=“FixRelativeToTop”2)是否创建Align=middle的样式并将其应用于您的商品-这可能会有所帮助。以下是我如何解决此问题的方法(iReport 3.7.6): 在“设计器”选项卡中:
<box topPadding="4"/>
示例w/静态文本代码块:
<staticText>
<reportElement positionType="Float" mode="Opaque" x="14" y="27" width="118" height="14" forecolor="#FFFFFF" backcolor="#909090"/>
<box topPadding="4"/>
<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" lineSpacing="Single" markup="none">
<font fontName="Arial" size="7" isBold="true" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false"/>
</textElement>
<text><![CDATA[SAMPLE TEXT SAMPLE TEXT]]></text>
</staticText>
我发现发布前图像和后图像很有帮助。前面的图像显示报告当前的显示方式。后面的图像显示了您希望报告的显示方式。我确实没有地方发布图像,但为了清晰起见,我将添加一些图表。lobster-您使用的是哪个版本的iReport?因为iReport可以更改一些标签,并且每次都需要检查。谢谢您的回答!不幸的是,我没有办法测试/尝试它,因为谢天谢地,我从2010年起就没有接触过jasper或iReport。然而,如果它对你有用的话,我想这对我来说已经足够了。