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

Free Support Forum - aspose.com

How to download workbook

Hi,

I create one workbook

Workbook wb = new Workbook();

wb.Worksheets.Add();

Worksheet ws = wb.Worksheets[0];

ws.Cells.ImportDataTable(datatable,true,"A1");

////// wb.Save("d:\\test.xls");

Now with out saving this file I want to show the options to user this work book has to open ,save and cancel,if he opens directly open ,else save into his system,

Is it possible using aspose.cells to download option like open, save,and cancel

In .net

like this,same is there any way using aspose.cells to direct download options,help me

Response.Clear();Response.Charset = "";

Response.AddHeader("Content-Disposition", "attachment;filename=" + "worldmapdownload_" + DateTime.Now.ToShortDateString().Replace(":", "").Replace(@"/", "").Replace(" ", "") + ".xls");

Response.TransmitFile("d:\\test.xls");

Response.End();

Hi;

Yes, you can get your desired result by using Aspose.Cells. In Aspose.Cells workbook.Save function has many overloaded methods which provides the user different options to save the files. You can use the following workbook.Save method to achieve your desired result.

workbook.Save(("test.xls", FileFormatType.Default, SaveType.OpenInExcel, System.Web.HttpContext.Current.Response);

This method will give the user download option of open, save,and cancel

Best Regards,

Hi,

Yes, quite possible, check the following line of code:

workbook.Save( “worldmapdownload_” + DateTime.Now.ToShortDateString().Replace(":", “”).Replace(@"/", “”).Replace(" ", “”) + “.xls”, FileFormatType.Default, SaveType.OpenInExcel, System.Web.HttpContext.Current.Response);

And for further reference about all the options that Workbook.Save method provides, kindly check: Different Ways to Save Files

Thank you.

This one is working fine

workbook.Save( "worldmapdownload_" + DateTime.Now.ToShortDateString().Replace(":", "").Replace(@"/", "").Replace(" ", "") + ".xls", FileFormatType.Default, SaveType.OpenInExcel, System.Web.HttpContext.Current.Response);

But I have to close the window after open or save or cancel.Response is not going to previous page.

After open or save the from which window we opened that same window is not closing

Hi,

Well, that's the routine of the browser (e.g.., IE) as the opened windows would not be closed. To confirm it, you may try the following code without involving Aspose.Cells API:

e.g..,

..........

this.Context.Response.Clear();

this.Context.Response.ContentType = "application/vnd.ms-excel";

this.Context.Response.AddHeader("content-disposition", "attachment; filename=Book1.xls");

this.Context.Response.OutputStream.Write(data, 0, data.Length);

this.Context.Response.End();

If you want to implement this, you should should create your own custom dialog box and use your own code to manage it.

Thank you.