locked
SpreadsheetGear RRS feed

  • Question

  • User1224235962 posted

    Dear All,

    Can anyone help me with SpreadSheetGear. I want to use this with my ASP.Net applications?

    Thanks,

    Sanjay

     

    Monday, September 27, 2010 3:04 AM

All replies

  • User793200426 posted

    Hello,

    for your Excel ASP.NET applications, you can also try this Excel .NET library.

    Here is a sample Excel C# code that exports DataGrid to Excel:

    // Get DataTable that DataGrid is bound to.
    var dataTable = (DataTable)dataGrid.DataSource;
    
    // Create new ExcelFile.
    var ef = new ExcelFile();
    // Add new worksheet to the file.
    var ws = ef.Worksheets.Add(dataTable.TableName);
    // Insert the data from DataTable to the worksheet starting at cell "A1".
    ws.InsertDataTable(dataTable, "A1", true);
    
    // Stream file to browser.
    Response.Clear();
    Response.ContentType = "application/vnd.ms-excel";
    Response.AddHeader("Content-Disposition", "attachment; filename=Employee.xls");
    ef.SaveXls(Response.OutputStream);
    Response.End();


    Wednesday, October 6, 2010 4:06 AM