Open the generated MS Excel file in the new browser window

Hi,

How can I force Aspose.Excel to open my spreadsheet in an new browser window? I’d prefer not to save to disk if at all possible.

Thanks,

Andy C

Hi, Andy.

You can place the Excel.Save function in a Page_Load event in a new aspx page. In you previous page, place a hyperlink which can create a new browser window and direct to this page.

Or you can use the OpenInExcel option to open the spreadsheet in an MS Excel window.

Thanks, it was just a case of my not having the code in the right place.

Andy

Andy -

Did you get this to work? If so can you give me a hand? (sample code :)) My client would like for the report to open in a new browser window also.

Thanks in Advance -

Steven Tidwell
stidwell@nospam.speedmarkweb.com

Hi Steven,

A simple sample is available here. Please use start.htm as the start page.

Thanks for the post Laurence, unfortunately I don’t think that will work.

What i have built for my client is a dynamic “ad-hoc” report system. They can choose a combination of about 20 different parameters to build a report. Once they have all the parameters set they want to click on the “make report” button and have it build the sql query and populate the report.

I first built it using the savetype.openinexcel but they did not like the “save” / “open” box that pops up. So my next try for them was to use the savetype.openinbrowser option, but then don’t like it opening in the main “build” window.

So if anyone knows how to disable the excel save box, or a way to have the report pop in a different browser window I would appreciate it.

Thanks

Steven Tidwell
The Woodlands, Texas

Hi Steven,

You can try the following two ways:

1. You can tell your client to do this:
Open Windows Explorer -> Tools -> Option -> File Type -> Select “XLS” file extension -> Uncheck the “Open In the same window” option in “Advanced” option. Then the report will be open in a different MS Excel window.

2. When user click the “make report” button, don’t directly post the report back, instead you can post a link back. Meanwhile you don’t call excel.save method but save the Excel object in memory. When the client click the link to open a new window, you retrieve the excel object and call the save method.