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

Free Support Forum - aspose.com

Unable to click the button to generate another report after saving via a dialog box

I'm currently creating a webpart for sharepoint in visual studio 2010. i use this code in a button event.

wb.Save(HttpContext.Current.Response, "MonthlyProgressReport-" + stringMonths.ToString("MMMM") + stringMonths.ToString("yyy") + ".xlsx", ContentDisposition.Attachment, ((SaveOptions)new XlsSaveOptions((SaveFormat.Xlsx))));
//wb.Save("report.xlsx", SaveType.OpenInBrowser, FileFormatType.Excel3, Response);

so after pressing the button, it will pop out a dialog box to allow me to save the workbook to the local drive. the problem is, if i want to save the workbook again by pressing the button, the dialog box doesn't pop up again. Only after i refresh the page, i'm able to press the button to generate the dialog box again. is there a way for me to allow a user to press the button multiple time to generate the dialogbox to save?


Well, I think your issue is not concerned to Aspose.Cells component rather a default behavior of the browser type. Aspose.Cells uses Response object in the background while retrieving the Excel spreadsheet on the client side. For confirmation, please do not involve Aspose.Cells component/APIs while retrieving the file, you should get the similar issue. You may replace the line of code with:
Sample code:

/Send workbook to response/
OoxmlSaveOptions xSaveOptions = new OoxmlSaveOptions(SaveFormat.Xlsx);

MemoryStream tempStream = new MemoryStream();
b.Save(tempStream, xSaveOptions);

//set the position.
tempStream.Position = 0;

this.Response.ContentType = “application/vnd.openxmlformats-officedocument.spreadsheetml.sheet”;
this.Current.Response.AddHeader(“content-disposition”, “attachment; filename=out1.xlsx” );

By the way, could you try to add a line at the end of your code segment if it works fine for your needs:


Thank you.

so what is the workaround this? is there a way to ‘refresh’ or reload the page after button is pressed?


Could you try to add a line at the end of your code for your issue:


Thank you.