It seems that jasperreports 3.5.3 can use two kinds of "excel writers". The by default exporter is JRXlsExporter
and doesn't work very well with big files (at least in my Spring MVC project).
A workaround is using the other exporter, based in JExcelAPI. I could export the data without trouble with this one.
For making jasperreport use JExcelAPI into a Spring MVC instalation you have to write a personalized class. Its very simple:
import net.sf.jasperreports.engine.JRExporter;
import net.sf.jasperreports.engine.export.JExcelApiExporter;
import org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsSingleFormatView;
// this is the view class you'll use, instead of JasperReportsXlsView
public class JasperReportsJExcelApiView extends AbstractJasperReportsSingleFormatView
{
// copied from JasperReportsXlsView
public JasperReportsJExcelApiView()
{
setContentType("application/vnd.ms-excel");
}
protected JRExporter createExporter()
{
// we create the JExcelAPIExporter, not the JRXlsExporter
return new JExcelApiExporter();
}
// copied from JasperReportsXlsView (I think it says: write binary data, not text)
protected boolean useWriter()
{
return false;
}
}
You'll need the jxl.jar in your classpath from the JExcelAPI 2.6 distribution.