Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Download xls and xlsx

    Isomorphic,

    Here is the code i am using to download the data from list grid.

    Code:
    exportButtonCSV.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    exportDataGrid(ExportFormat.OOXML);
    //exportDataGrid(ExportFormat.XLS);
                }
            });
    
    private void exportDataGrid(ExportFormat exportFormat) {
            DSRequest dsRequest = new DSRequest();
            dsRequest.setExportAs(exportFormat);
            dsRequest.setTimeout(EXPORT_TIMEOUT);
            dsRequest.setEndRow(EXPORT_FETCH_SIZE);
            dsRequest.setOperationId(searchManager.getReportsOperationID());
            dataGrid.exportData(dsRequest);
        }
    This (for all both XLS and XLSX/OOXML) works fine with GWT application server but when i configure my application with tomcat or apache web server, it wont download.

    I checked MIME type in mime.types file where i can see some entries for both XLS and XLSX. basically this results in 0Kb file with Result.xls.htm file.

    Please let me know is it a known issue or do i need to configure any other stuff.

    Thanks,
    Yathish

    #2
    Not a known issue (the Showcase runs on Tomcat) and no special configuration should be necessary. The fact that the file is received with a .htm extension suggests a mime type problem - you can troubleshoot the HTTP headers of the response using Firebug.

    Comment


      #3
      To continue with the same issue, i used to same code with XLS with tomcat, which works fine. But for XLSX format i used ExportFormat.OOXML (with tomcat) which throws the error shown below.


      Code:
      java.lang.Exception: Trouble loading Apache POI OOXML classes - are the poi-ooxm
      l and poi-ooxml-schemas .jar files deployed?  These are required in addition to
      the base POI .jar if you want to export in Excel 2007 format
              at com.isomorphic.rpc.ExcelDataExport.export(ExcelDataExport.java:138)
              at com.isomorphic.rpc.ExcelDataExport.exportResultSet(ExcelDataExport.ja
      va:96)
              at com.isomorphic.rpc.DataExport.exportResultSet(DataExport.java:506)
              at com.isomorphic.rpc.DataExport.exportResultSet(DataExport.java:389)
              at com.isomorphic.rpc.RPCManager.completeResponse(RPCManager.java:984)
              at com.isomorphic.rpc.RPCManager.send(RPCManager.java:582)
              at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156
      )
              at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
              at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
      icationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
      ilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
      alve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
      alve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
      ava:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
      ava:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
      ve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
      a:293)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
      :859)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
      ss(Http11Protocol.java:602)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:48
      9)
              at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException
              at com.isomorphic.rpc.OOXMLDataExport.getXSSFWorkbook(OOXMLDataExport.ja
      va:47)
              at com.isomorphic.rpc.ExcelDataExport.export(ExcelDataExport.java:136)
              ... 23 more
      Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
              at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
      der.java:1680)
              at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
      der.java:1526)
              ... 25 more
      However, a dialogue box apeared with Result.xlsx file with 0Kb. SO this is nothing to do with MIME type but APIs.

      Please let me know what is causing this? Am i missing any other configurations? I have poi.jar, poi-ooxml.jar,poi-ooxml-schemas.jar files in lib.

      Thanks,
      Yathish

      Comment


        #4
        Wherever you'd put those .jars it would appear they are not visible to Tomcat. You may have put them in the wrong directory, or they may not be readable files (owned by root for instance).

        Comment


          #5
          I had a similar issue when adding an export today. The issue isn't the poi jars - it is the org/apache/xmlbeans/XmlException class. I included the jaxp-api-1.4.jar (which contains this class) and the export now works. Is there a jar file in the normal SmartGWT PRO distribution that contains the XmlException class? I'm using SmartGWT PRO 3.0p with this marker from the console:
          SmartClient Version: SC_SNAPSHOT-2012-01-05_v8.2p/Pro Deployment (built 2012-01-05). I'm also using Java 1.6 but building to 1.5 levels for compatibility with the runtime environment where my client deploys their applications.

          Comment


            #6
            Could you please provide a list of jar dependencies required for XLSX/OOXML?
            Thanks

            Comment


              #7
              Take a look here, under isomorphic_core_rpc - http://smartclient.com/smartgwtee-latest/javadoc/com/smartgwt/client/docs/JavaModuleDependencies.html

              Comment


                #8
                Thank you kindly.

                Comment

                Working...
                X