Jump to content
JasperReports Library 7.0 is now available ×

Align right, align left and margin


2004 IR Help

Recommended Posts

By: dwich - dwich

Align right, align left and margin

2005-10-06 04:02

Hello,

I have a table with rows, which are hilited - even and odd rows have a different background color.

 

First column contains numbers, so I align it to the right, the second column to the left. But there is no space between this columns.

 

I tried to add non breakable space (like in HTML) but it didn't work.

 

I tried to shift (move) second column to the right (using x=something). It produced space between the columns but the background color of the row was divide into two blocks (table cells) - it splited the row.

 

How can i add more space between two colums without breaking the background color?

 

Here is an example of my JRXML:

 

 

<group name="EvenGroup">

<groupExpression><![CDATA[$V{REPORT_COUNT}]]></groupExpression>

<groupHeader>

<band height="14">

<printWhenExpression><![CDATA[$V{REPORT_COUNT}.intValue() % 2 == 1 ? Boolean.TRUE : Boolean.FALSE]]></printWhenExpression>

 

<textField isStretchWithOverflow="true">

<reportElement positionType="Float" x="0" y="0" width="20" height="14" /><textElement textAlignment="Right" /><textFieldExpression class="java.lang.Integer"><![CDATA[$F{web_user_id}]]></textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement positionType="Float" x="20" y="0" width="132" height="14" /><textFieldExpression class="java.lang.String"><![CDATA[$F{web_user_name}]]></textFieldExpression>

</textField>

 

........

some other columns

........

 

 

<group name="OddGroup">

<groupExpression><![CDATA[$V{REPORT_COUNT}]]></groupExpression>

<groupHeader>

<band height="14">

<printWhenExpression><![CDATA[$V{REPORT_COUNT}.intValue() % 2 == 0 ? Boolean.TRUE : Boolean.FALSE]]></printWhenExpression>

 

<textField isStretchWithOverflow="true">

<reportElement positionType="Float" x="0" y="0" width="20" height="14" mode="Opaque" backcolor="#C8D2FD" /><textElement textAlignment="Right" /><textFieldExpression class="java.lang.Integer"><![CDATA[$F{web_user_id}]]></textFieldExpression>

</textField>

 

<textField isStretchWithOverflow="true">

<reportElement positionType="Float" x="20" y="0" width="132" height="14" mode="Opaque" backcolor="#C8D2FD" /><textFieldExpression class="java.lang.String"><![CDATA[$F{web_user_name}]]></textFieldExpression>

</textField>

 

........

some other columns

........

 

 

Thanks for any advice,

Michal

 

 

 

 

By: Lucian Chirita - lucianc

RE: Align right, align left and margin

2005-10-06 05:00

Hi

 

You can use a borderless box with right/left padding for the textfields.

 

HTH,

Lucian

 

 

 

 

By: dwich - dwich

RE: Align right, align left and margin

2005-10-06 05:59

Can someone give me a <box> example? I downloaded all examples from official website and I didn't find any. And I can't force the <box> tag to work ;-)

 

Thanks a lot,

Michal

 

 

 

 

By: Lucian Chirita - lucianc

RE: Align right, align left and margin

2005-10-06 08:11

Check http://jasperreports.sourceforge.net/reference/indexty.html#textField if you have doubts regarding the jrxml structure.

 

You need somethig like this:

 

<textField>

<reportElement ../>

<box border="None" rightPadding="10"/>

<textElement textAlignment="Right"/>

<textFieldExpression..

 

 

HTH,

Lucian

Link to comment
Share on other sites

  • 6 years later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...