cancel
Showing results for 
Search instead for 
Did you mean: 

Saving excel file using HSSF api

Former Member
0 Kudos

I am using HSSF api to download an excel file. But the end users are not able to save the file. Some of them do not get the popup file download window so that they can choose to open or save. Is there a setting in the browser which shows up the window? The users may have different versions of excel on their pcs.

How to show the excel application menu 'file' so that users can save this file?

Any help would be appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi rao,

Are you setting the content disposition like following.


HttpServletResponse res = request.getServletResponse(true);
try {
  res.setContentType("application/vnd.ms-excel");
  res.setHeader("Content-disposition", "inline; filename=test.xls");
  } catch (Exception e) {
			e.printStackTrace();
}

Message was edited by: Prakash Singh

Former Member
0 Kudos

Prakash,

I have followed your weblog and set the content dispostion.

HttpServletResponse res = request.getServletResponse(true);

try {

res.setContentType("application/vnd.ms-excel");

res.setHeader("Content-disposition", "inline; filename=report.xls");

wb.write(res.getOutputStream());

} catch (Exception e) {

e.printStackTrace();

}

When I test this on my pc, I get file download window and I can choose 'open' or'save'. I also have tested this on some of my collegues PCs successfully. But the some of the end users are not getting this window.

when the same is file is downloaded by running an asp page the enire MSExcel application with standard tool bar and menus(file edit etc..) is showing up.

Why is it not poosible to get the same result using HSSF api?

Former Member
0 Kudos

It has nothing to do with HSSF api. The user can disable the popup and unchecking the box that shows up whenever you open a document via IE. You need to ask your users to enable dialog box by performing the following steps.

1. Clcik Start->Settings->Control Panel->Folder Options

2. Select the tab file types and scroll all the way down to XLS file types

3. Select the XLS and click on Advanced button

4. Select the <b>Confirm open after download</b>.

PS: Please don't forget to reward points for helpful answer or problem resolved.

regards,

prakash

Former Member
0 Kudos

Prakash,

Thanks for the help. Now the users get a popup

window and they can open or save the file. When they choose 'save' and download the file can they get another popup window with options 'open', 'openfolder','cancel'?

I remember doing this lot of times when I download some file. Any Idea where the settings are !

How do I reward points?

Regards

Rao

Former Member
0 Kudos

Prakash,

By unchecking 'Browse in same window' the xls file opens up in Excel with menu and standard tool bar and that is what my users wanted to see. Thanks for the right direction.

Rao

Former Member
0 Kudos

I am having a similar issue. I have data coming as String (pdd, word, excel) etc....and I want to take that data and send it to either a different iView or the simplest one would be to send it to a IE Window using window.open. I have tried a few things, but no luck yet......