You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Di...@equant.com on 2004/04/29 16:18:02 UTC
export to EXcel from JSP using POI framework
Hello All,
I have recently started using POI project for sending jsp data to excel
sheet.
Our requirement is to display data from JSP file into Excel worksheet .
I have the following test code to display my data in an Excel file ,
however
when the excel is launched it opens
a blank(empty) worksheet. Also Instead of displaying worksheet name I have
written in my program it shows my program file name (.jsp filename) as
worksheet name.
If any body can help me I will highly appreciate
response.setContentType("application/vnd.ms-excel");
response.setHeader ("Content-Transfer-Encoding","7bit");
response.setHeader("Content-Disposition","inline; filename =unknown.xls");
FileOutputStream outXls = new FileOutputStream("workbook.xls");
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("ATS Sheet");
// Create a row and put some cells in it. Rows are 0 based.
HSSFRow row = sheet.createRow((short)0);
HSSFCell cell = row.createCell((short)0);
HSSFCellStyle cellStyle = wb.createCellStyle();
cell = row.createCell((short)1);
cell.setCellValue("Test");
cell.setCellStyle(cellStyle);
wb.write(outXls);
outXls.close();
Thank You in advance
Dipak Patel
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org