Bibu Bibu - 3 months ago 11
ASP.NET (C#) Question

export data to excel file in an application

Can someone provide a link with a tutorial about exporting data to an excel file using c# in an web application.I searched the internet but I didn't find any tutorials that will explain how they do it.


You can use Interop

Or if you don't want to install Microsoft Office on a webserver I recommend using CarlosAg.ExcelXmlWriter which can be found here:

code sample for ExcelXmlWriter:

using CarlosAg.ExcelXmlWriter;

class TestApp {
    static void Main(string[] args) {
        Workbook book = new Workbook();
        Worksheet sheet = book.Worksheets.Add("Sample");
        WorksheetRow row =  sheet.Table.Rows.Add();
        row.Cells.Add("Hello World");