Hi,
what happens if you return the contents of the file (which is OK as you say)
directly in the response as in the following code?
        protected void service(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
                response.setContentType("application/vnd.ms-excel");
               
response.setHeader("Content-Disposition","attachment;filename=\"whatever.xls\"");
                OutputStream out=response.getOutputStream();
                 Workbook wb = new SXSSFWorkbook(-1);
                Sheet sh = wb.createSheet();
                for(int rownum = 0; rownum < 10000; rownum++){
                    Row row = sh.createRow(rownum);
                    for(int cellnum = 0; cellnum < 10; cellnum++){
                        Cell cell = row.createCell(cellnum);
                        cell.setCellValue("dummy text");
                    }
                   if(rownum % 100 == 0) {
                        ((SXSSFSheet)sh).flushRows(100);

                 
                   }
                }
                FileOutputStream fout = new
FileOutputStream("c:/whatever.xlsx");
                wb.write(fout);
                fout.close();
//copy workbook file data to out
                FileInputStream fin=new FileInputStream("c:/whatever.xlsx")
                byte[] chunk = new byte[1024];
                int count;
                while ((count = fin.read(chunk)) >=0 ) {
                    out.write(chunk,0,count);
                }
 
                out.close();
        } 
Can you test this? If this works then there may be a problem in SXSSF but I
suspect that this isn't going to work either. 
Regards,
Alex


--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/problem-opening-excel-2007-created-using-SXSSF-tp4705693p4879149.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to