We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cells 5.3.2 Open spreadsheet in browser

I’m having trouble getting a worksheet to open in the browser. I am using Aspose.Cells 5.3.2. I am reading in an Excel 2003 file, processing the data, and inserting the output into an Excel 2003 template. Once this is working correctly, I will add the capability to handle .xlsx files.

The code I initially used brought up an error that said it was obsolete. After some research, I tried the following code:

Excel1.Save(HttpContext.Current.Response, “OHLAPEligResults.xls”, ContentDisposition.Attachment, New XlsSaveOptions(SaveFormat.Excel97To2003))
HttpContext.Current.Response.End()

My goal is to open the output (OHLAPELigResults.xls) in the user’s browser and allow him to either print the file or save it. This is not happening. I’ve stepped through the code and all is well until the Excel1.Save… line of code. I’ve also tried using ContentDisposition.Inline, but I still do not get the file to open in the user’s browser.

Where am I going wrong?

Thank you for your assistance.

Hi,

I found, inline makes the file open directly in Ms-Excel instead of saving it. However, it does not open the file inside browser.

You should also now download and use the latest version:
Aspose.Cells for .NET (Latest Version)


C#
////Save file and send to client browser using selected format

workbook.Save(HttpContext.Current.Response, “CustomerLabels.xls”, ContentDisposition.Inline, new XlsSaveOptions(SaveFormat.Excel97To2003));

Hi,


I also recommend you to see the document (especially the sub-topic “3. Saving file to Response Object” in the document)
https://docs.aspose.com/display/cellsnet/Different+Ways+to+Save+Files


Thank you.