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

How to set a cell pattern using net.sf.jasperreports.export.xls.pattern to export time format to Excel when there is no value


hongming8888

Recommended Posts

Hi all,
I'm currently creating a budget management excel report.

The report has a budget entry field using Text Field element.

converted-file.png.1f2eeeaec23e99f34c108c38400460b3.png

This item is blank and is an operational specification in which the budget manager inputs the amount to the export in Excel report.

And it is a requirement that this item has Excel amount formatting.

If there are any numbers, for example zero, it will format fine.
converted-file.png.6dd2d94cc00702783792c5098735810c.png

However, if there is no value, the set format could not be reflected in the cell.

converted-file.png.218c615b75fa70c417ecc303aee57c60.png

I have tried two formatting methods.

Method 1: How to format the Patten property of a Text Field element

<textField pattern="#,##0">

 

Method 2: How to set the net.sf.jasperreports.export.xls.pattern property in the Text Field element and format the Value

<textField>

<reportElement key="" style="Style7" x="104" y="42" width="58" height="14" uuid="cb95cc41-dd52-4ca3-9c53-211993d223dd">

<property name="net.sf.jasperreports.export.xls.pattern" value="#,##0"/>

</reportElement>

</textField>

 

Reference article:net.sf.jasperreports.export.xls.pattern to export time format to Excel | Jaspersoft Community

 

Is there a way to force the format even if there is no value?

 

The version of Studio I'm using is 6.5.1.


Best Regard.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Posted Images

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