poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sharma, Siddharth" <Siddharth.Sha...@Staples.com>
Subject RE: Opening HSSF Workbook in Excel
Date Tue, 15 Feb 2005 15:20:10 GMT
That is a fair comment.
I am also vaguely aware of this behavior in IE.
But I thought setting the content type explicitly overrode this behavior.

Anyhow, as to using a servlet v/s a JSP, again comes down to container
implementations. The request and response objects, even though should be the
same classes, could be of different types in servlets and JSPs as long as
they implement the HTTPServletRequest and HTTPServletResponse interfaces
respectively.
Maybe in your container, they are different implementations to support some
vendor extension. (MAYBE!! Could easily be some other more trivial reason).

As I said, your JSP worked fine when I ran it on my side (Websphere).




-----Original Message-----
From: Iain.Shepherd@barclayscapital.com
[mailto:Iain.Shepherd@barclayscapital.com] 
Sent: Tuesday, February 15, 2005 9:54 AM
To: poi-user@jakarta.apache.org
Subject: RE: Opening HSSF Workbook in Excel

(Totally off the top of my head)

could your browser have been making dodgy guesses at the filetype? I
know I had a situation (in ASP) where naming my script 'renderjpeg.aspx'
didn't work - correct MIME type notwithstanding - but
'renderjpeg.jpg.aspx' worked fine.

So maybe you could've tried naming the JSP '.xls.jsp...'

What I experienced was documented dodgy behaviour in IE, though I don't
have the link for it right now.



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


Hey,
  Today i tried replacing my jsp with a servlet.It's working
fine.Anyway,i don't see why it didn't work with the JSP.

Thanks guys.

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


I copy-posted your code and ran it, it worked fine.
Try setting the content length. Maybe your server is not setting the
content length header, or something on those lines.


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

Tried this too.Nope.Still the same problem.

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


Try doing this for all cells and see if this works.
I am not sure if this will fix your problem though. But try it.

cell1_New.setCellType(HSSFCell.CELL_TYPE_STRING);


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

It seems it didn't refresh properly.Hence i saw some binary data showing
up on the browser window.I tried closing the browser and opened a new
instance. Now,it opens up an Excel but some junk is being shown inside
the excel. 

thanks,


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


Could you explain what you mean by "It is showing the output on the
browser itself."?


-----Original Message-----
From: Vytla, Aparna (GE Commercial Finance, NonGE)
[mailto:aparna.vytla@ge.com] 
Sent: Monday, February 14, 2005 4: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/


---------------------------------------------------------------------
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/


---------------------------------------------------------------------
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/



------------------------------------------------------------------------
For more information about Barclays Capital, please
visit our web site at http://www.barcap.com.


Internet communications are not secure and therefore the Barclays 
Group does not accept legal responsibility for the contents of this 
message.  Although the Barclays Group operates anti-virus programmes, 
it does not accept responsibility for any damage whatsoever that is 
caused by viruses being passed.  Any views or opinions presented are 
solely those of the author and do not necessarily represent those of the 
Barclays Group.  Replies to this email may be monitored by the Barclays 
Group for operational or business reasons.

------------------------------------------------------------------------


---------------------------------------------------------------------
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