Hi guys,
I've used the example code to import the data from a gridview control into an Excel spreadsheet and want to serve the newly-created workbook up to the user to save somewhere but it isn't working.
Here's the code I'm using:
//Instantiate a new workbook
Workbook workbook = new Workbook();
//Get the first worksheet in the workbook
Aspose.Cells.Worksheet worksheet = workbook.Worksheets[0];
//Import data from GridView control to fill the worksheet
worksheet.Cells.ImportGridView(grdDispatched, 0, 0, false, true, false);
//workbook.Save("c:\\PrintRoomDispatchSummary.xls");
//Save with default format, send the file to user so that he may open the file in
//some application or save it to some location
workbook.Save(this.Response, "PrintRoomDispatchSummary.xls", ContentDisposition.Attachment, new XlsSaveOptions());
The code crashes Internet Explorer, and Firefox is more resilient, but neither prompts the user to save the file.
If I comment out the save and reinstate the save to disk it works fine, but I really need it to serve up the file.
Is there something I need to do to get this working or have I done something wrong?
Thanks in advance,
Paul.