textAlignment="Right" has no effect

The Jasper documentation is unbelievable. 

How does one align output? 

Everything aligns left. 

I've changed <textElement> to <textElement textAlignment="Right"> to no effect.

Any ideas?

martin.clarke's picture
Joined: Apr 20 2015 - 2:28am
Last seen: 7 years 7 months ago

Thanks peter.w

This is SO frustrating.  I just posted a detailed reply and there's no sign of it.  This works but aligns left.  If I incorporate your suggestion naively it errors. 

If I implement it slightly more intelligently, it doesn't error, but doesn't work.

This is a diabolical interface.  I posted this twice as an Answer and it failed.

<textField isStretchWithOverflow="true">
  <reportElement style="Detail" positionType="Float" x="333" y="0" width="111" height="18" uuid="8dd14df6-2cf5-4bd2-b126-886246c57f8b"/>
    <textElement>
      <font size="14"/>
    </textElement>
    <textElement textAlignment="Right"> <-----
    </textElement>                      <-----
  <textFieldExpression><![CDATA[$F{timeworked}]]></textFieldExpression>
</textField>
 
<textField isStretchWithOverflow="true">
  <reportElement style="Detail" positionType="Float" x="333" y="0" width="111" height="18" uuid="8dd14df6-2cf5-4bd2-b126-886246c57f8b"/>
    <textElement textAlignment="Right"> <-----
      <font size="14"/>
    </textElement>                      <----- 
  <textFieldExpression><![CDATA[$F{timeworked}]]></textFieldExpression>
</textField>

martin.clarke - 8 years 4 months ago

Stroll on Peter.  Hope against experience said try to progress the thread with an Answer or Edit, but it has to be a Comment again:

WHA HOO!  Not only must one do it for the column detail, one must do it for the column header:

    <columnHeader>
        <band height="26" splitType="Stretch">
...
            <staticText>
                <reportElement style="Column header" x="333" y="7" width="111" height="18" forecolor="#000000" uuid="c403ee30-44b8-44fb-8775-fd9be9db62d0"/>
                <textElement textAlignment="Right"> <-----
                    <font isBold="false"/>
                </textElement>
                <text><![CDATA[Hours Worked]]></text>
            </staticText>
...
        </band>
    </columnHeader>
    <detail>
        <band height="18" splitType="Stretch">
            <frame>
...
                <textField isStretchWithOverflow="true">
                    <reportElement style="Detail" positionType="Float" x="333" y="0" width="111" height="18" uuid="8dd14df6-2cf5-4bd2-b126-886246c57f8b"/>
                    <textElement textAlignment="Right"> <-----
                        <font size="14"/>
                    </textElement>
                    <textFieldExpression><![CDATA[$F{timeworked}]]></textFieldExpression>
                </textField>
...
            </frame>
        </band>
    </detail>
 

Now we know peter! You probably did anyway and assumed I wasn't a TOTAL noob! : )

Thanks again for being part of the process.

Regards

Martin

martin.clarke - 8 years 4 months ago

5 Answers:

This should work.

<textElement textAlignment="Right">
</textElement>

(

peter.w's picture
1513
Joined: Oct 12 2012 - 6:57am
Last seen: 4 months 1 week ago

Thanks peter.w, please see my comment!

martin.clarke's picture
Joined: Apr 20 2015 - 2:28am
Last seen: 7 years 7 months ago

Hi

Yes I know some times my posts go all wonky on here as well. And when you are already having problems its the last thing you want

There are only two other areas I can suggest having a look at

1) The styles eg <style name="Style1"/>  If you have any?  Try without any styles? 

2) Any markups eg markup="styled"  but this is _usually_ in the textElement and you don't have any.

Other than that I am out of ideas.

 

peter.w's picture
1513
Joined: Oct 12 2012 - 6:57am
Last seen: 4 months 1 week ago

Thank you very much peter.w - I'll soldier on!

I'll be back soon with other dumb questions.

Regards

Martin

martin.clarke's picture
Joined: Apr 20 2015 - 2:28am
Last seen: 7 years 7 months ago

As I say on my next Comment above Peter, WAH-HOO!

martin.clarke's picture
Joined: Apr 20 2015 - 2:28am
Last seen: 7 years 7 months ago
Feedback