occoa occoa - 5 months ago 31
Java Question

Format of thousands to export Excel - DynamicReports

I'm using DynamicReports 4.0 and I'm having one problem to export the number and decimal values in Excel. The values appears in text format and I need that the values appears in numbers format and decimals in this format "#,###.##".

I need the values in the title and this is not working:

HorizontalListBuilder hlb = cmp.horizontalList();

hlb.newRow().add(
cmp.text(1000).setPattern("#,###.##")
);

ComponentBuilder<?, ?> componentBuilder = hlb;


I hope that somebody can help me.

Thanks a lot

Answer

Finally, I found an answer that solved my problem. I only needed add the next property for my report:

JasperReportBuilder builder = report()
                .addProperty("net.sf.jasperreports.export.xls.detect.cell.type", "true")

I found this and other usefull properties in the next link:

http://jasperreports.sourceforge.net/config.reference.html

Comments