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 04:24
Song David is currently offline Song David
Messages: 185
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 05:21]

Report message to a moderator

Previous Topic:Problem with RWT-OSGi integration bundle on JBoss 7.2
Next Topic:FilteredTree not working correctly for custom TreeViewer
Goto Forum:

Current Time: Thu Jul 24 19:05:23 EDT 2014

Powered by FUDForum. Page generated in 0.01921 seconds