Jump to content
Changes to the Jaspersoft community edition download ×

String values in excel report missing "0"

2004 IR Help

Recommended Posts

By: bgriff - bgriff

String values in excel report missing "0"

2005-04-19 03:20



I have a data base column in my mySQL db of type varchar. If this colum contains a value like "0987654321" the "0" at the start of the string is dropped when the values is exported to an Excel report.

I have tried setting the textfield pattern to pattern="##############" but this does not work.


Anyone know how to fix this?






By: bgriff - bgriff

RE: String values in excel report missing "0"

2005-04-19 03:53

ok i've looked into this a bit more and found that this problem does not occur if i export the report in CSV format.

It must be to do with the format of the cell in Excel because i can reproduce this problem just by opening an blank excel file and putting the string "0987654321" into a cell. The only way to fix this is to fisrt right click on the cell, select "Format Cell" and then select "Text" from the "Number" tab and then enter the value into the cell.


Is there anyway to set this so that Jasper will set the cell format to "Text" when i am exporting the results?


Please help, its urgent!





By: Denny Valliant - xenden

RE: String values in excel report missing "0"

2005-04-19 09:53

This is where RTFM comes in handy.


You could try something like:


exporter.setParameter(JRXlsExporterParameter.IS_AUTO_DETECT_CELL_TYPE, Boolean.FALSE);


But i don't know if it would help or not. Haven't messed with XLS too much. I do know there is something called loadedCellStyles in the exporter... don't knwo what it does tho.


Then there is the old tried and true [pre/ap]pend some text to the freaking value.


Hope this freaking helps. =-)

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

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