Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Excel file generated by poi can not been downloaded in IE6?
Excel file generated by poi can not been downloaded in IE6? [message #981254] Mon, 12 November 2012 09:24
David Song is currently offline David SongFriend
Messages: 211
Registered: April 2011
Senior Member
Hi all,
in my project, I have to use rap 1.4.2 and IE6, and I want to use apache poi to generate ms excel file from the database and export excel file in IE6. My code works well in any other browsers except MS IE6. and the snippet just like below:

public void run() {
		RWT.getServiceManager().registerServiceHandler( EXCEL_SERVICE_HANDLER,  new ExcelServiceHandler("projects.xls") );
	    RWT.getSessionStore().setAttribute( EXCEL_KEY, ProjectStatisticsToExcelResourse.getExcelContent(projectTypes) );
	    URL url;
		try {
			url = new URL(createPDFUrl(EXCEL_KEY));
		} catch (MalformedURLException e) {
		} catch (PartInitException e) {
	private String createPDFUrl( String string ) {
	    StringBuffer url = new StringBuffer();
	    url.append( "?" );
	    url.append( IServiceHandler.REQUEST_PARAM );
	    url.append( "=" );
	    url.append( EXCEL_SERVICE_HANDLER );
	    url.append( "&nocache=" );
	    url.append( System.currentTimeMillis() );
	    String encodedURL = RWT.getResponse().encodeURL( url.toString() );
	    return encodedURL;

		InputStream in = (InputStream) RWT.getSessionStore().getAttribute(
		HttpServletResponse response = RWT.getResponse();
		String contentDisposition = "attachment; filename=" + fileName;
		response.setHeader("Content-Disposition", contentDisposition);
		response.setHeader("Content-Transfer-Encoding", "binary");
		// response.setHeader("Pragma", "no-cache");
		// response.setHeader("Cache-Control", "no-cache, must-revalidate");

		ByteArrayOutputStream bos = new ByteArrayOutputStream();
		int next =;
		while (next > -1) {
			next =;
		byte[] result = bos.toByteArray();

		try {
			ServletOutputStream out = response.getOutputStream();
		} catch (IOException e) {

and the attachment is the project archive file.

thank you very much


[Updated on: Mon, 12 November 2012 10:21]

Report message to a moderator

Previous Topic:Eclipse Juno RAP problem
Next Topic:rwt standalone rap 1.5 deployed in jboss occror error like Not installing optional component!
Goto Forum:

Current Time: Mon Jun 25 04:37:20 GMT 2018

Powered by FUDForum. Page generated in 0.01671 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top