Jump to content
We've recently updated our Privacy Statement, available here ×

Formatting $ on left and amount on right.


white_falcon02

Recommended Posts

In a text box, I am looking to format an amount so that the $ appears on the right side of the box, and the amount on the left similar to how excel displays amounts. This report will actually be exported to Excel when it is ran and sent to the accountants. Is it possible to do as I ask?

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Try to use a PATTERN-Expression (not the static pattern) like this:

"###,###.000" + $F{Currency}

for your right aligned textfield. So the whole field content sould be right aligned with the currency appended .

Your thread-subject actually inverses your question!?!?!? So in subject you ask for currency to the left and amount on the right. So I'm a little bit confused, what you actually want to reach!?!?

But just inverse the pattern expression in this case:

$F{Currency} + "###,###.000"

hth + regards 

C-Box

Link to comment
Share on other sites

as previous poster said, your question is confusing because in the title you ask one thing and in the question text itself the opposite. Regardless, you can use both Pattern and Pattern expression for this. For example pattern ¤#### will put the currency symbol in front, ####¤ will put it in the end.

Link to comment
Share on other sites

As already discussed above, you'll need to set a currency pattern for the textfield, to be considered in output formats other than Excel (PDF, HTML, etc).

For the Excel output, you also need to set the net.sf.jasperreports.export.xls.pattern property for that textfield, in order to generate an Excel-specific accounting pattern when exporting to Excel. Try to use the following expression:

<propertyExpression name="net.sf.jasperreports.export.xls.pattern">    <![CDATA["$\ * #,##0.00;$\ * -#,##0.00"]]></propertyExpression>

 

 

Link to comment
Share on other sites

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...