Jump to content
We've recently updated our Privacy Statement, available here ×

Excel found unreadable content in 'report.xml' ...


riesvantwisk

Recommended Posts

Hey All, I am getting the below error sometimes for my Escel 2003/excel2007 users.

Excel found unreadable content in 'report.xml' Do you wsnt to recover the contents of this workbook?
If you trust the source of this workblook click yes

However open office opens that same document perfectly fine.

Currently I have no idea why this happens, below the core I use to generate a report:

All my data is in UTF-8, but I am sure that that couldn't be a issue.. When the users send me the repaired report, then at line xxx I see some garbaged characters, and that's all... in my own dataset I don't see anything that might cauze an issue (Data comes from PostgreSQL).

 

Hopefully somebody has a clue what's going on.

Ries

Code:
	public String  getJasperReport(List<Map<String, Object>> data, String basename, String reportname, String type) throws Exception {		JasperReport jasperReport;		JasperPrint jasperPrint;		String filename="";		basename = basename + "_" + String.valueOf(ACL.getUserID());		JRListMapDataSource ds = new JRListMapDataSource(data);		// Get path relative to our current deployment to find the temp directory		Map<String, Object> params = new HashMap<String, Object>();				URL U = Thread.currentThread().getContextClassLoader().getResource("../../tmp");			// Load report		InputStream strm = Thread.currentThread().getContextClassLoader().getResourceAsStream("../../jrxml/"+reportname+".jrxml");				jasperReport = JasperCompileManager.compileReport(strm);				jasperPrint=JasperFillManager.fillReport(jasperReport, params, ds);		//		generates PDF		if (type.compareTo("PDF") == 0) {			filename = basename+".pdf";			JasperExportManager.exportReportToPdfFile(jasperPrint, U.getPath() + filename);		}				// generate XLS		if (type.compareTo("XLS") == 0) {			filename = basename+".xls";			JRXlsExporter exporterXLS = new JRXlsExporter();			File destFile = new File(U.getPath() + filename);			exporterXLS.setParameter(JRXlsExporterParameter.JASPER_PRINT, jasperPrint);			exporterXLS.setParameter(JRXlsExporterParameter.OUTPUT_FILE_NAME, destFile.toString());			exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); 			exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE); 			exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE); 			exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE); 			exporterXLS.exportReport();		}				return filename;	}	
Link to comment
Share on other sites

  • Replies 16
  • Created
  • Last Reply

Top Posters In This Topic

I found the possible cauze, but I don't understand wyet why.

 

Apparently when I use JExcelApiExporter I don't have the problem so it looks like there is a bug in JRXlsExporter or in the poi library?? is it correct to say that JRXlsExporter uses the POI libs??

 

Can anybody confirm/know something about this?

 

Ries

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

I can confirm that the JRXlsExporter uses POI.

But in order to track down this problem and solve it, we need a report with hardcoded content that would enable us to reproduce the problem here. Otherwise we would be chasing a ghost.

 

Thank you,

Teodor

 



Post Edited by Teodor Danciu at 03/02/09 16:53
Link to comment
Share on other sites

  • 2 weeks later...

I'm having the same problem. Seems worse with large reports.

I'm trying to use the JExcelApiExporter work around, but now I'm getting a "java.lang.NoSuchFieldError: AUTOMATIC" error. Apparently the JExcelApiExporter can't find "Colour.AUTOMATIC"

Any clue what library I need for it to find this?

 

 

Link to comment
Share on other sites

  • 4 months later...

This post is a bit stale but I was getting the same error with JR 3.5.2 and POI 3.6. So I changed from the JRXlsExporter to the JExcelApiExporter using ver 2.6.  I found this post and tried 2.6.3 and can not seem to get past this error.  Any suggestions or people getting the same error?  My exporter configuration matches the OP so I won't repost the code.

 

Thanks,

Mjack



Post Edited by mjack003 at 07/23/2009 15:45
Link to comment
Share on other sites

  • 2 weeks later...

Hi,

 

We managed to track down the problem and solve it. It appeared in JR 3.1.0 and is now solved on SVN. As some of you found out, you can rely on the JExcelApiExporter to generate Excel. They have similar capabilities.

The fix will be part of the next release. Until then, you can try it from SVN.

 

Thank you,

Teodor

 

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Hi Teodord,

I tried using the latest version of jasperreports(3.6.0) expecting it has the solution to the problem. But I am still getting the same error. I am using MS Excel 2007. When there is no data in the the excel file creted, it fails to open the file stating

"Excel found unreadable content in 'ChargeableEventdetail.xlsx'. Do you want to recover the contents of this workbook?"

Can you guide me where I might be going wrong.

Thanks

Link to comment
Share on other sites

  • 2 months later...

Hi

I came across the same problem while trying to use JExcelApiExporter api for the xml export. I am using iReport 1.2.5. The code snippet and the error is given below. I am getting the output  error as shown in attachement 1 while opening the excel. When i click on OK , it continues to show me the error as in attachement 2 and then opens the excel. This is happening perticularly in case of of large amount of data present in the exported excel i.e. aroung 4-5k rows. I checked the excel but not able to found any damaged cell/column.

I am getting the output

Please suggest.

Code:
if(outputFormat.equalsIgnoreCase("xls")){exporter = new JExcelApiExporter ();exporter.setParameter(JRXlsExporterParameter.IS_AUTO_DETECT_CELL_TYPE,Boolean.TRUE);exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);response.setContentType("application/vnd.ms-excel");}
Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

gaurav12,

Why do you use the *.xlsx file extension for your file? The POI exporter does not produce Excel 2007 format. What exporter class are you using anyway?

 

ravindra_hibare,

We already said on this thread that such problems were fixed recently. We are not going to fix older versions of our products, not even iR 1.2.5 that you say you use.

 

Thank you,

Teodor

 

Link to comment
Share on other sites

  • 1 year later...

 Teodor, hi

We are seeing this with jasper 3.7.3 using this code:

 

JRXlsxExporter exporter = new JRXlsxExporter();exporter.setParameter(JExcelApiExporterParameter.JASPER_PRINT, ((RPPrintJR) print).getJasperPrint());exporter.setParameter(JExcelApiExporterParameter.OUTPUT_STREAM, output);exporter.setParameter(JExcelApiExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);exporter.setParameter(JExcelApiExporterParameter.IS_FONT_SIZE_FIX_ENABLED, Boolean.TRUE);exporter.exportReport();

 

When I give the OK to try to open the file it opens with this message:

Excel was able to open the file repairing or removing unreadable content:

Removed feature: Hyperlinks from /xl/worksheets/sheet1.xml part



Post Edited by damiankober at 04/05/2011 10:26
Link to comment
Share on other sites

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