riesvantwisk Posted February 19, 2009 Share Posted February 19, 2009 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 yesHowever 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.RiesCode: 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 More sharing options...
riesvantwisk Posted February 19, 2009 Author Share Posted February 19, 2009 I just updated to 3.1.4 with POI 3.2 with no change in the results.Question: Is it possible to tell jasperreports the output version of excel??Ries Link to comment Share on other sites More sharing options...
riesvantwisk Posted February 20, 2009 Author Share Posted February 20, 2009 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 More sharing options...
dimaa Posted February 28, 2009 Share Posted February 28, 2009 yes, the same problem with poi Link to comment Share on other sites More sharing options...
rram Posted March 2, 2009 Share Posted March 2, 2009 i too faced these type of problem, if i used JExcelApiExporter then i can able to get the result with out any problem Link to comment Share on other sites More sharing options...
teodord Posted March 2, 2009 Share Posted March 2, 2009 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 More sharing options...
riesvantwisk Posted March 2, 2009 Author Share Posted March 2, 2009 Teodor, well.. luckily there are more people that found the same sort of ghost so the ghost is quite visible however I will try to make a self-contained test case for you to checkout. Ries Link to comment Share on other sites More sharing options...
joethejet Posted March 11, 2009 Share Posted March 11, 2009 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 More sharing options...
joethejet Posted March 11, 2009 Share Posted March 11, 2009 Ah, got it. You need http://mirrors.ibiblio.org/pub/mirrors/maven/net.sourceforge.jexcelapi/jars/jxl-2.6.3.jar to go with Japer 3.1.4 Link to comment Share on other sites More sharing options...
mjack003 Posted July 23, 2009 Share Posted July 23, 2009 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,MjackPost Edited by mjack003 at 07/23/2009 15:45 Link to comment Share on other sites More sharing options...
teodord Posted August 1, 2009 Share Posted August 1, 2009 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 More sharing options...
dtrobert Posted August 14, 2009 Share Posted August 14, 2009 Teodor, I can reproduce this easily with Jasper Report 3.5.3 and poi 3.2. Let me know what you would like to reproduce it. How can I get you a report with hardcoded content? (ours pulls from postgres). Link to comment Share on other sites More sharing options...
teodord Posted August 17, 2009 Share Posted August 17, 2009 Hi, As I mentioned in my previous post, I think we have solved this, but the fix will be shipped with the next version of JR.Until then, you could try the SVN head version. Thank you,Teodor Link to comment Share on other sites More sharing options...
gaurav12 Posted October 7, 2009 Share Posted October 7, 2009 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 More sharing options...
ravindra_hibare Posted December 31, 2009 Share Posted December 31, 2009 HiI 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 outputPlease 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 More sharing options...
teodord Posted January 21, 2010 Share Posted January 21, 2010 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 More sharing options...
damiankober Posted April 5, 2011 Share Posted April 5, 2011 Teodor, hiWe 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 partPost Edited by damiankober at 04/05/2011 10:26 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now