Jump to content
Changes to the Jaspersoft community edition download ×

Excel: Premature end of file


Recommended Posts

By: Kjetil T. - kjetolle

Excel: Premature end of file

2003-06-06 02:21

I'm trying to compile a report to an xls-file. The creation of the sourcefile seems to be OK (the sourcefile occurs in the correct directory), but when I'm running the application, I receive the following error(s):

 

org.apache.commons.digester.Digester - Parse Fatal Error at line -1 column -1: Premature end of file.

(This first error seems to be from the xml-parser)

 

dori.jasper.engine.JRException: Premature end of file.

(This second error seems to be from the JRLoader)

 

If anyone has the solution to this problem, help would be great!

 

 

 

 

 

By: Teodor Danciu - teodord

RE: Excel: Premature end of file

2003-06-15 13:11

 

Hi,

 

I'm not sure what are you trying to do.

Is it about exporting to XLS format or is about

working with XML files?

 

Thank you,

Teodor

 

 

 

 

 

By: Kjetil T. - kjetolle

RE: Excel: Premature end of file

2003-06-17 01:45

Hello. I have created a report which works fine in both preview and printing mode. This report also creates a PDF-file on a network drive. No problems so far...

 

I then use the methods for creating an XLS-file as seen in the samples. Actually, I copy the code block and try to adjust it to my existing report, like this:

 

try{

Connection connection = null;

JasperFillManager.fillReportToFile(jasperReport, newFile.getAbsolutePath(), parameters, new JRBeanCollectionDataSource(collector));

} catch (JRException jre) {

throw new IllegalStateException("Can't fill report:" + jre);

}

JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(newFile);

File destFile = new File(newFile.getParent(), jasperReport.getName() + ".xls");

 

JRXlsExporter exporter = new JRXlsExporter();

 

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());

exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);

 

exporter.exportReport();

 

I'm not sure this explains the whole situation. The sample code also seems to require an existing report before making the XLS-file, but I can't find out where, and therefore I can't tell the difference between my report and the report made in the sample.

 

 

 

 

By: Teodor Danciu - teodord

RE: Excel: Premature end of file

2003-07-07 12:54

 

Hi,

 

The report filling operation produces a *.jrprint file

on disk.

But only if you are using the JasperFillManager and

not the JasperRunManager.

It is this *.jrprint file that can be exported to XLS

format.

 

The fillReportToFile() method that you mentioned

return yu the name of this file and you can pass it

to the exporter as the JRExporterParameter.INPUT_FILE_NAME

parameter, without having to load a JasperPrint

object from it yourself.

 

I hope this helps.

Teodor

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