Summary: | Unable to save excel file after generating it with HSSF | ||
---|---|---|---|
Product: | POI | Reporter: | sazzadul haq <syed.sazzadul.haq> |
Component: | HSSF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED INVALID | ||
Severity: | critical | ||
Priority: | P2 | ||
Version: | 2.5-FINAL | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | Windows XP | ||
Attachments: |
Generated excel file
Template file |
Description
sazzadul haq
2005-04-22 09:13:43 UTC
Created attachment 14782 [details]
Generated excel file
Generated excel file
Created attachment 14783 [details]
Template file
Template file
This bug, as attached, fails to show any bug in POI. The code attached fails to compile, making it impossible to make sense out of it. "Very strange" is not something anyone can debug. This bug, as attached, fails to show any bug in POI. The code attached fails to compile, making it impossible to make sense out of it. "Very strange" is not something anyone can debug. I am adding a very simple code which will compile and I am facing same problem with this simple code. The genarated excel file looks very strange. Could it be something with my excel template ? package no.nordea.klow.web.actions; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.ServletOutputStream; import javax.servlet.ServletException; import java.io.IOException; import java.io.FileInputStream; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.poifs.filesystem.POIFSFileSystem; public class ExcelServlet extends HttpServlet { private final static String CONTENT_TYPE = "application/vnd.ms-excel"; private ServletOutputStream out; public void init() throws ServletException { } public void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("doDelete method entered"); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("doGet method entered"); out = response.getOutputStream(); response.setContentType(CONTENT_TYPE); HSSFWorkbook workbook = null; try { POIFSFileSystem fsfilesystem = new POIFSFileSystem(new FileInputStream("C:\\MO\\nordea.xls")); workbook = new HSSFWorkbook(fsfilesystem); workbook.write(out); out.close(); } catch (Exception e) { e.printStackTrace(); } } } |