2006 IR Open Dicussion Posted August 26, 2006 Share Posted August 26, 2006 By: jcrob - jcrob JExcelApiExporter fails to compile 2006-03-01 04:40 Hi, The support for jxl that was included in a recent verion, is quite excellent, it is a great improvement on the previous way of doing it, however, there is a small problem with using the JExcelApiExporter code in the samples. In JRXlsAbstractExporter, the member class TextAlignHolder is not specified as public or protected, and JExcelApiExporter extends this class and tries to access the member class, which causes a compile fail. To fix this, just specify the member class as protected. Similarly, TextAlignHolder has some attributes that JExcelApiExporter attempts to access directly. These should be made public to facilitate this. Just thought I'd let you know. If you like I can upload the fix for this. Howe do I do this? Regards, JCrob By: Lucian Chirita - lucianc RE: JExcelApiExporter fails to compile 2006-03-01 05:58 Hi Which compiler are you using to compile the sample? The inner class has package access and JExcelApiExporter is declared in the same package as JRAbstractExporter. This case should not produce a compilation error. However, you are right, the inner class should be protected and its members public so that it can be accessed from any subclass of JRAbstractExporter (not only the ones declared in the same package). I've commited the changes on CVS. Checkout revision 1.13 and see whether it's ok. Thank you, Lucian By: jcrob - jcrob RE: JExcelApiExporter fails to compile 2006-03-01 08:31 Hi Lucian, Wow that was a fast response, thank you. Yes you are correct, you would not see this case if the class that extends JRAbstractExporter is in the same package. My code was in a different package, as it is not part of the base jasperreports (Maybe the JExcelApiExporter class should be? I wouldn't need to include it with my code then) I tried compiling using javac of Java 1.4.2_08 and Java 1.5.0_05. I do the compiles inside Eclipse. I can't seem to connect to cvs (I am having connectivity problems to sourceforge in general), so I will have a look later, but what you said above sounds perfect. Thanks again, JCrob Link to comment Share on other sites More sharing options...
milind Posted September 13, 2006 Share Posted September 13, 2006 I want to export report in Excel with image, I m using jasperreports-1.2.6.jar file and jxl-2.7.jar class lib.But i receive an exception on the webpage(see attachment). Here is code snap JExcelApiExporter exporterAPIXLS = null;exporterAPIXLS = new JExcelApiExporter();response.setContentType("text/plain");//response.setContentType("application/vnd.ms-excel");exporterAPIXLS.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);exporterAPIXLS.setParameter(JExcelApiExporterParameter.OUTPUT_FILE_NAME, "Hello.xls");//exporterAPIXLS.setParameter(JRExporterParameter.OUTPUT_STREAM,response.getOutputStream());exporterAPIXLS.setParameter(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);exporterAPIXLS.setParameter(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);exporterAPIXLS.setParameter(JExcelApiExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);exporterAPIXLS.setParameter(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);exporterAPIXLS.exportReport();response.getOutputStream().close(); I m new to Java and JasperReport, so plz let me know whats the problem. Exception Details: java.lang.IllegalAccessError tried to access method jxl.write.biff.WritableFontRecord.setStruckout(Z)V from class net.sf.jasperreports.engine.export.JExcelApiExporter Thanks.MilindPost edited by: milind, at: 2006/09/13 08:29 Link to comment Share on other sites More sharing options...
milind Posted September 13, 2006 Share Posted September 13, 2006 Hi All,Sorry!! now the previous problem is solved.I had some wrong version of libs. But, I do get other error for Xls Export including images.(Pdf works fine) some portion of error displayed in browser : description The server encountered an internal error () that prevented it from fulfilling this request. exception:com.sun.rave.web.ui.appbase.ApplicationException: getOutputStream() has already been called for this response com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.destroy(ViewHandlerImpl.java:601) com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:316) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87) com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117) Regards,Thanks Link to comment Share on other sites More sharing options...
lucianc Posted September 13, 2006 Share Posted September 13, 2006 Are you using a JSP to write the XLS file to the response stream? If so, you should consider switching to a servlet as it would be easier to control what exactly gets written to the response. HTH,Lucian Link to comment Share on other sites More sharing options...
milind Posted September 14, 2006 Share Posted September 14, 2006 Hi, Thanks for prompt reply.I had used HttpServletResponse object in incorrect way, know it working fine. But, I still have problem while exporting report in RTF,XLS formats. When bitmap images are exported to RTF or XLS report the XLS report is blank and Rtf report could not be displayed by browser. While debugging I found that exportToOutputStream() of JRRtfExporter through an exceprion, leaving the outputstream in invalid state.I am trying to pin point and resolve the problem, if u have any idea please reply. Regards,Thanks.Milind. Link to comment Share on other sites More sharing options...
lucianc Posted September 20, 2006 Share Posted September 20, 2006 What exception did exportToOutputStream() throw? Can you post the stacktrace? Regards,Lucian 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