English 中文(简体)
Jasper Reports Excel output
原标题:

I need to generate a report in Excel format using Jasperreports. I am using iReports 3.7.0 The reports gets generated with no issues except the size of empty cells.

alt text

Can somebody please tell how to avoid the highlighted cell being enlarged. Also the normal cells are also a little larger than their content.

问题回答

Also,I would say stick to basics when you need to export Japser to XLS. I mean no graphics, and more.

The above solution is good for generating XLS from iReport.

If you would like to generate XLS thru program; use the following code

exporter = new JRXlsExporter();
exporter.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
exporter.setParameter(JRXlsExporterParameter.IS_IGNORE_GRAPHICS, Boolean.TRUE);

Also - if you re deploying to jasperserver you can set the custom properties within the report. (iReport doesn t do this automatically)

In the properties of the main report element add:

net.sf.jasperreports.export.xls.collapse.row.span
net.sf.jasperreports.export.xls.remove.empty.space.between.columns
net.sf.jasperreports.export.xls.remove.empty.space.between.rows

and set them all to true





相关问题
Export MS Charts to PDF and Excel

I need to export a few (could be just one or more than one) Microsoft Charts to a PDF and Excel. It needs to happen on a button click and the charts should be directly exported to a PDF without ...

CSV files and multi line text cells

I am generating a simple csv file using php. The file contains some user s personal data. When I open the generated file in office, the addresses are not displayed in full height. I have to double ...

Generate an Excel XML document in Asp.net MVC Web Site

I have an ASP.Net MVC site that generates a Microsoft Excel 2003 XML formatted spreadsheet. The spreadsheet looks good, the controller and views both work, but the file won t open in Excel. It opens ...

Jasper Reports Excel output

I need to generate a report in Excel format using Jasperreports. I am using iReports 3.7.0 The reports gets generated with no issues except the size of empty cells. Can somebody please tell how to ...

Pear Excel Writer: trimming leading zeros - how to prevent?

I m using the Pear Excel Writer package to export a dataset to Excel from PHP. My problem is some of the data fields have leading zeros (such as a zip code), but these are being trimmed in Excel. I ...

Making new colors in JExcelApi

I m using JExcelApi for generating XLS files. From jxl.format.Colour, I see how to get any of the colors in the "standard Excel colour palette", but not how to create a new color (say, given its RGB)....

Gridview: Export to csv issue

I have the following scenario. I have two methods of populating a GridView with data. These are as follows: protected void btSearch_Click(object sender, EventArgs e) { lqPackWeights....

热门标签