开发者

Create Excel File programatically in C# without Microsoft.Office.Interop.Excel

开发者 https://www.devze.com 2023-02-14 04:34 出处:网络
I need to create and populate excel file in c#. With Microsoft.Office.Interop.Excel , it can be created easily but it need to install Offi开发者_StackOverflow社区ce on server. I am looking for solutio

I need to create and populate excel file in c#. With Microsoft.Office.Interop.Excel , it can be created easily but it need to install Offi开发者_StackOverflow社区ce on server. I am looking for solution without Office installation and without any third party components.


It depends, if you just need to create an export that your user need to be able to open with Excel, then you might think of creating a CSV export.

Otherwise you may consider NPOI. I know it's a third-party lib, but it's open source :)


At my previous company, we created a "template" excel workbook (docx) and used the System.IO.Packaging classes to open it in code, and replace the contents of the cells.

This also had the advantage of allowing us to style the spreadsheet up in Excel (in the template) to give a much prettier report!


You could just use the OpenOffice API, which is free. It will have basically the same functionality as Office and the spreadsheets created with it are compatible with Excel. OpenOffice API Wiki

0

精彩评论

暂无评论...
验证码 换一张
取 消