I have a table in a jasper report, and I need the contents of certain cells in that table to be vertically aligned. I'm attempting to edit the report with iReport.
In iReport I can go into the properties of a cell and see that the vertical align is set to "Middle". Additionally, when I look at the XML directly (see below), I can see that the textElement tag has a verticalAlignment="Middle" attribute.
So near as I can tell the text should be vertically aligned within its little box, and yet it will not align properly.
I'm hoping that someone experienced with vertically aligning things in jasper reports can point out what I'm doing wrong. Thanks much.
<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>
So, to be clear, what I have in my report is something like this:
|--------|
| text |
| |
| |
|--------|
And what I want is something like this:
|--------|
| |
| text |
| |
|--------|
Best Answer
Here's how I fixed this problem (iReport 3.7.6):
In Designer tab:
As you can see, this will allow you to position your Static Text exactly how you want.
If you can only make the change in the XML, this is how the change showed up in XML:
Example w/ the Static Text code block: