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

Free Support Forum - aspose.com

Exporting the grid out to an excel spreadsheet

I am curious if anyone can help me out with one last thing to get this web application published for a while…I am trying to send the grid out to an excel spreadsheet and I am pretty sure it can handle it, just unsure of exactly how to go about the export process.
Thanks again and appreciate all your help.

Hi,

Yes you may export gridweb's date to excel spreadsheets. You may use WebWorksheets.SaveToExcelFile() method to save an excel file.

e.g.., You may choose GridWeb's SaveCommand event to place your saving code.

protected void GridWeb1_SaveCommand(object sender, System.EventArgs e)
{
// Generates a temporary file name.
string filename = System.IO.Path.GetTempPath() + Session.SessionID + ".xls";

// Saves to the file.
this.GridWeb1.WebWorksheets.SaveToExcelFile(filename);

// Sents the file to browser.
Response.ContentType = "application/vnd.ms-excel";

//Adds header.
Response.AddHeader("content-disposition", "attachment; filename=book1.xls");

// Writes file content to the response stream.
Response.WriteFile(filename);

// OK.
Response.End();
}

For further reference, please check the doc: http://www.aspose.com/documentation/visual-components/aspose.grid-for-.net/saving-an-ms-excel-file.html

Thank you.