0 Replies Latest reply on May 25, 2010 1:04 PM by manfredini08

    Internet Explorer doesn't work with excel - Seam Framework

    manfredini08

      Hello,


      I've make a xls report (I used Microsoft Excel spreadsheet) and it works for all browsers but internet explorer.
      In all browsers, when I call the report, browser show me the option to save it but in the internet explorer, it tries to open the report in the own browser.
      How do I do the internet explorer gives the option to save the report?


      Code:


      xhtml


      <e:workbook xmlns:e="http://jboss.com/products/seam/excel"
                     xmlns:s="http://jboss.com/products/seam/taglib"   
                  xmlns:ui="http://java.sun.com/jsf/facelets"
                  xmlns:rich="http://richfaces.org/rich"
                      xmlns:h="http://java.sun.com/jsf/html"
                     xmlns:f="http://java.sun.com/jsf/core"
                     xmlns:c="http://java.sun.com/jstl/core"
                     useTemporaryFileDuringWrite="true"
                     filename="Lista de Atividades"
                       workbookProtected="false">
           
           <e:worksheet showGridLines="true" name="Lista de Atividades">
           
                <e:worksheet name="Lista de Atividades"  value="#{academicoAction.getListaDiarioAulasBranco('1', '10')}" var="listaAluno"
                           startRow="0" startColumn="0" sheetProtected="false">
                
                     <e:column style="xls-border: THIN white" >
                          <e:cell>     
                               <h:outputText value="" />
                          </e:cell>
                     </e:column>
                
                </e:worksheet>
                
                <e:worksheet name="Lista de Atividades"  value="#{academicoAction.getListaVazia('1')}" var="listaAluno"
                           startRow="10" startColumn="0" sheetProtected="false">
                
                     <e:column style="xls-border-top: THIN white; xls-border-left: THIN white; xls-border-bottom: THIN white" >
                          <e:cell>     
                               <h:outputText value="" />
                          </e:cell>
                     </e:column>
                
                </e:worksheet>
                
                <e:worksheet name="Lista de Atividades"  value="#{academicoAction.getListaDiarioAulasBranco('1', '10')}" var="listaAluno"
                           startRow="0" startColumn="9" sheetProtected="false">
                
                     <e:column style="xls-border: THIN white" >
                          <e:cell>     
                               <h:outputText value="" />
                          </e:cell>
                     </e:column>
                
                </e:worksheet>
      
                <e:worksheet name="Lista de Atividades" value="#{academicoAction.getListaVazia('1')}" var="listaAluno"
                           startRow="10" startColumn="9" sheetProtected="false">
                
                     <e:column style="xls-border-top: THIN white; xls-border-right: THIN white; xls-border-bottom: THIN white" >
                          <e:cell>     
                               <h:outputText value="" />
                          </e:cell>
                     </e:column>
                
                </e:worksheet>
      
                <e:mergeCells startRow="0" endRow="2"
                     startColumn="1" endColumn="8"/>
                <e:cell row="0" column="1" value="" style="xls-border: THIN white"/>
      
                <e:mergeCells startRow="#{academicoAction.getListaVazia('11').size}" endRow="#{academicoAction.getListaVazia('12').size}"
                     startColumn="0" endColumn="9"/>
                <e:cell row="#{academicoAction.getListaVazia('11').size}" column="0"
                     value="" style="xls-border-left: THIN white; xls-border-right: THIN white; xls-border-bottom: THIN white"/>
                     
                <e:worksheet name="Lista de Atividades" value="#{academicoAction.matriculaDiarioList}" var="listaAluno"
                           startRow="10" startColumn="1" sheetProtected="false">
                
                     <e:mergeCells startRow="3" endRow="3"
                          startColumn="1" endColumn="8"/>
                     <e:cell row="3" column="1"
                          value="Título da Atividade: #{academicoAction.textoCabecalho}"
                          style="xls-border: THIN white; xls-font-bold: true; xls-alignment: centre"/>
                          
                     <e:mergeCells startRow="4" endRow="4"
                          startColumn="1" endColumn="8"/>
                     <e:cell row="4" column="1" value="" style="xls-border: THIN white"/>
                
                     <e:cell row="5" column="1"
                          value="Professor:"
                          style="xls-border: THIN white; xls-font-bold: true; xls-alignment: right"/>
                     <e:mergeCells startRow="5" endRow="5"
                          startColumn="2" endColumn="8"/>
                     <e:cell row="5" column="2"
                          value="#{academicoAction.professor.pessoaFisica.nome}"
                          style="xls-border: THIN white; xls-alignment: left"/>
                          
                     <e:cell row="6" column="1"
                          value="Curso:"
                          style="xls-border: THIN white; xls-font-bold: true; xls-alignment: right"/>
                     <e:mergeCells startRow="6" endRow="6"
                          startColumn="2" endColumn="8"/>
                     <e:cell row="6" column="2"
                          value="#{academicoAction.cursoPeriodoLetivo.curso.nome}"
                          style="xls-border: THIN white; xls-alignment: left"/>
                          
                     <e:cell row="7" column="1"
                          value="Turma:"
                          style="xls-border: THIN white; xls-font-bold: true; xls-alignment: right"/>
                     <e:mergeCells startRow="7" endRow="7"
                          startColumn="2" endColumn="6"/>
                     <e:cell row="7" column="2"
                          value="#{academicoAction.turma}"
                          style="xls-border: THIN white; xls-alignment: left"/>
                          
                     <e:mergeCells startRow="7" endRow="7"
                          startColumn="7" endColumn="8"/>
                     <e:cell row="7" column="7"
                          value="Total Alunos: #{academicoAction.totalDeAlunos}"
                          style="xls-border: THIN white; xls-alignment: right"/>
                          
                     <e:cell row="8" column="1"
                          value="Disciplina:"
                          style="xls-border: THIN white; xls-font-bold: true; xls-alignment: right"/>
                     <e:mergeCells startRow="8" endRow="8"
                          startColumn="2" endColumn="6"/>
                     <e:cell row="8" column="2"
                          value="#{academicoAction.disciplina.nome}"
                          style="xls-border: THIN white; xls-alignment: left"/>
                          
                     <e:mergeCells startRow="8" endRow="8"
                          startColumn="7" endColumn="8"/>
                     <e:cell row="8" column="7"
                          value="#{academicoAction.dataCabecalho}"
                          style="xls-border: THIN white; xls-alignment: right"/>
                          
                     <e:mergeCells startRow="9" endRow="9"
                          startColumn="1" endColumn="8"/>
                     <e:cell row="9" column="1" value="" 
                          style="xls-border-top: THIN white; xls-border-left: THIN white; xls-border-right: THIN white"/>
                     
                     <e:column style="xls-alignment: centre; xls-column-width: 3000; xls-border: THIN black">
                          <f:facet name="header">
                               <e:cell value="MATRÍCULA" style="xls-background-color: GREY_40_PERCENT"/>
                          </f:facet>
                          <e:cell value="#{(listaAluno != null) ? listaAluno.matricula.alunocurso.codigo : '000000'}"
                               style="xls-font-family: Arial; xls-font-size: 7;" forceType="text"/>
                     </e:column>
                     
                     <e:column style="xls-column-autosize: true; xls-alignment: left; xls-border: THIN black">
                          <f:facet name="header">
                               <e:cell value="NOME DO ALUNO(A)" style="xls-background-color: GREY_40_PERCENT"/>
                          </f:facet>
                          <e:cell value="#{listaAluno.matricula.alunocurso.aluno.pessoaFisica.nome}"
                               style="xls-font-family: Arial; xls-font-size: 7;"/>
                     </e:column>
                     
                     <e:column style="xls-column-width: 4500; xls-border: THIN black">
                          <f:facet name="header">
                               <e:cell value="" style="xls-background-color: GREY_40_PERCENT"/>
                          </f:facet>
                          <e:cell value=""/>
                     </e:column>
                     
                     <e:column style="xls-column-width: 4500; xls-border: THIN black">
                          <f:facet name="header">
                               <e:cell value="" style="xls-background-color: GREY_40_PERCENT"/>
                          </f:facet>
                          <e:cell value=""/>
                     </e:column>
                     
                     <e:column style="xls-column-width: 4500; xls-border: THIN black">
                          <f:facet name="header">
                               <e:cell value="" style="xls-background-color: GREY_40_PERCENT"/>
                          </f:facet>
                          <e:cell value=""/>
                     </e:column>
                     
                     <e:column style="xls-column-width: 4500; xls-border: THIN black">
                          <f:facet name="header">
                               <e:cell value="" style="xls-background-color: GREY_40_PERCENT"/>
                          </f:facet>
                          <e:cell value=""/>
                     </e:column>
                     
                     <e:column style="xls-column-width: 4500; xls-border: THIN  black">
                          <f:facet name="header">
                               <e:cell value="" style="xls-background-color: GREY_40_PERCENT"/>
                          </f:facet>
                          <e:cell value=""/>
                     </e:column>
                     
                     <e:column style="xls-column-width: 4500; xls-border: THIN black">
                          <f:facet name="header">
                               <e:cell value="" style="xls-background-color: GREY_40_PERCENT"/>
                          </f:facet>
                          <e:cell value=""/>
                     </e:column>
                     
                     <e:mergeCells startRow="#{academicoAction.getListaVazia('10').size}" endRow="#{academicoAction.getListaVazia('10').size}"
                          startColumn="1" endColumn="8"/>
                     <e:cell row="#{academicoAction.getListaVazia('10').size}" column="1" 
                          value="#{academicoAction.dataRodape.substring('5')}" 
                          style="xls-border-bottom: THIN white; xls-border-left: THIN white; xls-border-right: THIN white; xls-alignment: right;"/>
                
                </e:worksheet>
                
           </e:worksheet>
           
      </e:workbook>



      components.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
                  xmlns:core="http://jboss.com/products/seam/core"
                  xmlns:persistence="http://jboss.com/products/seam/persistence"
                  xmlns:drools="http://jboss.com/products/seam/drools"
                  xmlns:bpm="http://jboss.com/products/seam/bpm"
                  xmlns:security="http://jboss.com/products/seam/security"
                  xmlns:mail="http://jboss.com/products/seam/mail"
                  xmlns:document="http://jboss.com/products/seam/document"
                      xmlns:web="http://jboss.com/products/seam/web"
                      xmlns:excel="http://jboss.com/products/seam/excel"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation=
                      "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.1.xsd 
                       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.1.xsd 
                       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.1.xsd
                       http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.1.xsd
                       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.1.xsd
                       http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.1.xsd
                       http://jboss.com/products/seam/document http://jboss.com/products/seam/document-2.1.xsd
                       http://jboss.com/products/seam/excel http://jboss.com/products/seam/excel-2.1.xsd                 
                       http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.1.xsd
                       
                       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.1.xsd">
      
         <core:init debug="false" jndi-pattern="@jndiPattern@"/>
           
         <core:manager concurrent-request-timeout="500" 
                       conversation-timeout="120000" 
                       default-flush-mode="MANUAL"
                       conversation-id-parameter="cid"
                       parent-conversation-id-parameter="pid"/>
          
          
          
          <document:document-store use-extensions="true"  />
          
          <core:resource-loader>
                <core:bundle-names>
                     <value>mensagens</value>
                     <value>mensagens_local</value>
                </core:bundle-names>
           </core:resource-loader>
          
      </components>
      





      web.xml


      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
        <display-name>PortalProfessor</display-name>
        <context-param>
          <param-name>webAppRootKey</param-name>
          <param-value>portalprofessor</param-value>
        </context-param>
        <context-param>
          <param-name>org.richfaces.SKIN</param-name>
          <param-value>blueSky</param-value>
        </context-param>
        <context-param>
          <param-name>facelets.LIBRARIES</param-name>
          <param-value>/WEB-INF/tagsinfo/ci_tagsinfo.xml</param-value>
        </context-param>
        <context-param>
          <param-name>facelets.DEVELOPMENT</param-name>
          <param-value>false</param-value>
        </context-param>
        <context-param>
          <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
          <param-value>.xhtml</param-value>
        </context-param>
        <filter>
          <filter-name>Seam Filter</filter-name>
          <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
        </filter>
        <filter-mapping>
          <filter-name>Seam Filter</filter-name>
          <url-pattern>/*</url-pattern>
        </filter-mapping>
        <listener>
          <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
        </listener>
        <servlet>
          <servlet-name>Faces Servlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet>
          <servlet-name>Document Store Servlet</servlet-name>
          <servlet-class>org.jboss.seam.document.DocumentStoreServlet</servlet-class>
        </servlet>
        <servlet>
          <servlet-name>Seam Resource Servlet</servlet-name>
          <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
        </servlet>
        <servlet-mapping>
          <servlet-name>Faces Servlet</servlet-name>
          <url-pattern>*.unifor</url-pattern>
          <url-pattern>/faces/*</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
          <servlet-name>Document Store Servlet</servlet-name>
          <url-pattern>*.pdf</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
          <servlet-name>Document Store Servlet</servlet-name>
          <url-pattern>*.xls</url-pattern>
        </servlet-mapping>  
        <servlet-mapping>
          <servlet-name>Seam Resource Servlet</servlet-name>
          <url-pattern>/seam/resource/*</url-pattern>
        </servlet-mapping>
        <welcome-file-list>
          <welcome-file>index.html</welcome-file>
          <welcome-file>index.jsp</welcome-file>
        </welcome-file-list>
        <error-page>
          <error-code>403</error-code>
          <location>/login.unifor</location>
        </error-page>
        <error-page>
          <error-code>404</error-code>
          <location>/login.unifor</location>
        </error-page>
       <error-page>
          <error-code>500</error-code>
          <location>/login.unifor</location>
        </error-page>  
        <security-constraint>
          <display-name>Restrict raw XHTML Documents</display-name>
          <web-resource-collection>
            <web-resource-name>XHTML</web-resource-name>
            <url-pattern>*.xhtml</url-pattern>
          </web-resource-collection>
          <auth-constraint/>
        </security-constraint>
        <login-config>
          <auth-method>BASIC</auth-method>
        </login-config>
        <filter>
          <display-name>RichFaces Filter</display-name>
          <filter-name>richfaces</filter-name>
          <filter-class>org.ajax4jsf.Filter</filter-class>
          <init-param>
            <param-name>maxRequestSize</param-name>
            <param-value>5500000</param-value>
          </init-param>
          <init-param>
            <param-name>createTempFiles</param-name>
            <param-value>false</param-value>
          </init-param>
          <init-param>
            <param-name>forceparser</param-name>
            <param-value>false</param-value>
          </init-param>
        </filter>
        <filter-mapping>
          <filter-name>richfaces</filter-name>
          <servlet-name>Faces Servlet</servlet-name>
          <dispatcher>REQUEST</dispatcher>
          <dispatcher>FORWARD</dispatcher>
          <dispatcher>INCLUDE</dispatcher>
        </filter-mapping>  
      </web-app>