Announcement Announcement Module
Collapse
No announcement yet.
Internet explorer not saving excel files Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Internet explorer not saving excel files

    Hello,

    First of all I am new to spring, if I have searched for solution at web but can not figure out the solution.

    I have a controller which reads requests, generates excel file and writes it via HttpServletRequest's outputStream.

    Firefox and Chrome tries to save the xls file. But internet explorer 9 tries to view the content of the file. Some ideas would be great.

    PHP Code:
    @RequestMapping("/excel/*.xls")
        public 
    ModelAndView handleRequest(HttpServletRequest argRequestHttpServletResponse argResponsethrows Exception
        
    {
            
    this.initFonts();
            
    Map<StringStringrequestParams ReportUtilFactory.getInstance().getCsvReader().readParameterMapFromRequest(argRequest);
            
    this.reportData ReportUtilFactory.getInstance().getReportDataReader().getReportdata(requestParams);
            
    OutputStream outputStream argResponse.getOutputStream();
            
    WorkbookSettings wbSettings = new WorkbookSettings();
            
    wbSettings.setLocale(new Locale("tr""TR"));
            
    WritableWorkbook workbook Workbook.createWorkbook(outputStreamwbSettings);
            
    workbook.createSheet("Report"0);
            
    WritableSheet excelSheet workbook.getSheet(0);
            
    this.addCommonInfo(excelSheetthis.reportData);
            
    this.setColumnWidths(excelSheetthis.reportData);
            
    this.addHeaders(excelSheetthis.reportData);
            
    this.addRows(excelSheetthis.reportData);
            
    workbook.write();
            
    workbook.close();
            
    argResponse.setContentType("application/x-msexcel");
            
    argResponse.setHeader("Content-Disposition""attachment; filename=sheet.xls");
            return 
    null;
        } 
    +This is a screen shot if I am not clear:
    http://i53.tinypic.com/2akgzo8.png

    Thanks.

    --
    Mehmet ÇADIRCI
Working...
X