locked
Create Excel files RRS feed

  • Question

  • User-1199946673 posted

    Many times, people ask how to create Excel file in ASP.NET. Most of the times, people use Microsoft.Office.Interop.Excel, which is not supported nor recommended by Microsoft. There are some third party controls on the market, but I never found an Open Source component that could do the job, untill today. In another thread someone pointed to an Codeplex project, and to my surprise, it really seems to work quit well, so I think I should post this here, because this is one of the most common questions in this forum.

    So if you want to create Excel files in ASP.NET, check this out:

    http://npoi.codeplex.com/

    Tuesday, February 16, 2010 8:55 PM

All replies

  • User1611391320 posted

    u can use respone object for that

    response.contenttype="";

    response.flush();

    and set various properties

    and then do response.Write(StreamWriter ) ; to get the excel

    Wednesday, February 17, 2010 1:07 AM
  • User-1199946673 posted

    Just by changing the contenttype you won't get a real excel file, you just telling that the html table should be opened with excel. When you open this file in excel, you'll get the warnig that the file is not in the rght format, but yes, it will open the file and you can see the table. But you cannot create multiple sheets, set all kinds of properties, etc... and create a real excel file which this component can do.

    Wednesday, February 17, 2010 7:30 AM
  • User-319574463 posted

    Thank you for the link to http://npoi.codeplex.com/

    According to the CodePlex entry, it can also work on word and power point files.

    Saturday, February 20, 2010 3:51 AM