poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hamu, Dave" <Dave.H...@Avnet.com>
Subject RE: Opening HSSF Workbook in Excel
Date Mon, 14 Feb 2005 21:17:17 GMT
You are right.  There's one more step to get it to load into Excel
directly instead of a browser window:

response.setHeader("Content-Disposition","attachment; filename=" +
myFileName); 

- Dave

-----Original Message-----
From: Vytla, Aparna (GE Commercial Finance, NonGE)
[mailto:aparna.vytla@ge.com] 
Sent: Monday, February 14, 2005 2:15 PM
To: POI Users List
Subject: RE: Opening HSSF Workbook in Excel

Hi Siddharth,
  Thanks for your quick response.I've tried that too.It is showing the
output on the browser itself.Here is my sample jsp page.

<%@ page import = "java.util.*, java.text.*,
javax.servlet.http.*,org.apache.poi.hssf.usermodel.*" %> <%
		response.setContentType("application/vnd.ms-excel");
		
		HSSFWorkbook wb = new HSSFWorkbook();
		HSSFSheet sheet_New = wb.createSheet("New Contacts");

		HSSFSheet sheet_Mod = wb.createSheet("Modified
Contacts");
		HSSFSheet sheet_Del = wb.createSheet("Deeleted
Contacts");
	
		
		HSSFRow header_New = sheet_New.createRow((short)0);
		HSSFRow header_Mod = sheet_Mod.createRow((short)0);
		HSSFRow header_Del = sheet_Del.createRow((short)0);

	
		HSSFCell cell1_New = header_New.createCell((short)0);
		HSSFCell cell2_New = header_New.createCell((short)1);
		HSSFCell cell3_New = header_New.createCell((short)2);
		HSSFCell cell4_New = header_New.createCell((short)3);
		
		cell1_New.setCellValue("First_Name");		
		cell2_New.setCellValue("Last_Name");		
		cell3_New.setCellValue("Middle_Name");		
		cell4_New.setCellValue("Suffix_Name");		
		
		
		HSSFCell cell1_Mod = header_Mod.createCell((short)0);
		HSSFCell cell2_Mod = header_Mod.createCell((short)1);
		HSSFCell cell3_Mod = header_Mod.createCell((short)2);
		HSSFCell cell4_Mod = header_Mod.createCell((short)3);
		
		cell1_Mod.setCellValue("Suffix");		
		cell2_Mod.setCellValue("Last_Name");		
		cell3_Mod.setCellValue("Middle_Name");		
		cell4_Mod.setCellValue("Suffix_Name");		
		
		
		HSSFCell cell1_Del = header_Del.createCell((short)0);
		HSSFCell cell2_Del = header_Del.createCell((short)1);
		HSSFCell cell3_Del = header_Del.createCell((short)2);
		HSSFCell cell4_Del = header_Del.createCell((short)3);
		
		cell1_Del.setCellValue("Deal_Name");		
		cell2_Del.setCellValue("PAM_Name");		
		cell3_Del.setCellValue("Middle_Name");		
		cell4_Del.setCellValue("Suffix_Name");	
				    
		wb.write(response.getOutputStream());
		

%>
 
Let me know if you have any other suggestions.

thanks,
-Aparna.



-----Original Message-----
From: Sharma, Siddharth [mailto:Siddharth.Sharma@Staples.com]
Sent: Monday, February 14, 2005 4:03 PM
To: POI Users List
Subject: RE: Opening HSSF Workbook in Excel


response.setContentType("application/vnd.ms-excel");
hssfWorkbook.write(response.getOutputStream);

where
response is an instance of HTTPServletResponse hssfWorkbook is the
workbook you just created. An instance of HSSFWorkbook



-----Original Message-----
From: Vytla, Aparna (GE Commercial Finance, NonGE)
[mailto:aparna.vytla@ge.com] 
Sent: Monday, February 14, 2005 3:59 PM
To: poi-user@jakarta.apache.org
Subject: Opening HSSF Workbook in Excel

Hi Folks,
  I'd like to know if we can open a HSSF workbook in Excel without
creating
a physical file on the filesystem.I tried writing the workbook directly
to
the OutputStream of my JSP.But it doesn't work.

Post me if you have turn around to this.

Appreciate your response.

regards,
-Aparna.


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message