4 Replies Latest reply on Jun 25, 2009 9:52 PM by Francisco Jose Peredo Noguez

    strange behaviour of excel export on IE

    Jose Miguel Loor Apprentice

      I have to generate an excel file, but i had to do it "by hand" (i had some limitations using the excel exporter). After generating the file with POI i wanted to export it.

      This is the piece of code i use to it:
           private void redirectExport(final HSSFWorkbook workbook) {
                String viewId = Pages.getViewId(FacesContext.getCurrentInstance());
                String baseName = baseNameForViewId(viewId);
                DocumentType documentType = new DocumentData.DocumentType("xls", "application/vnd.ms-excel");
                DocumentData documentData = new DocumentData(baseName, documentType, workbook.getBytes());
                String id = DocumentStore.instance().newId();
                String url = DocumentStore.instance().preferredUrlForContent(baseName, documentType.getExtension(), id);
                url = Manager.instance().encodeConversationId(url, viewId);
                DocumentStore.instance().saveData(id, documentData);
                try {
                } catch (IOException e) {
                     throw new ExcelExporterException(Interpolator.instance().interpolate("Could not redirect to #0", url), e);

      As you can see, the method gets the created workbook and then redirects it to the user for opening/downloading.

      Using firefox/openoffice, it works great, the file can be opened or downloaded just fine. But using internet explorer/excel, the file cannot be opened. When i hit the open button in ie, it gives me this message:

      "The file you are trying to open, 'seam-docstore.seam', has a different format than the specified by the file extension. ...(bla, bla, bla). Would you like to open? "

      If i click yes or no, then it throws an error saying that the service / connection, is not available ??

      Any thoughts ?? thanks a lot
        • 1. Re: strange behaviour of excel export on IE
          Nicklas Karlsson Master

          Try using extensions filter so you get a .xls dl-link

          • 2. Re: strange behaviour of excel export on IE
            Jose Miguel Loor Apprentice

            Hi, thanks for the response

            Ok, an improvement. Now i get the filename.xls link not the seam-docstore.seam one, but when i try to open the file, i get the same connection error

            any other ideas ???

            • 3. Re: strange behaviour of excel export on IE
              Jose Miguel Loor Apprentice
              this is what i did, by the way:


                              <servlet-name>Document Store Servlet</servlet-name>

                              <servlet-name>Document Store Servlet</servlet-name>



              <components xmlns:document="http://jboss.com/products/seam/document"
                      xsi:schemaLocation="http://jboss.com/products/seam/excel http://jboss.com/products/seam/excel/excel-2.1.xsd http://jboss.com/products/seam/document http://jboss.com/products/seam/document-2.1.xsd">

              <document:document-store use-extensions="true"/>


              <class-loading java2ClassLoadingCompliance="false">

              also, in the server/instance/lib, added: jboss-seam-excel.jar. jxl.jar

              • 4. Re: strange behaviour of excel export on IE
                Francisco Jose Peredo Noguez Master

                When I have that kind of problem I use Fiddler to inspect the response and see if there is something wrong with it (for example by comparing it with the response of a system that is returning the excel files properly).