I am using Microsoft Excel Interop library for exporting Excel file. However, the limit of this library is that:
- Require the user's computer must have Microsoft Excel.
- When write the content, Microsoft Excel must be opened to automate.
- To save file, user must do manually: click on File -> Save.
I need a library:
- Write the content to memory with Excel format.
- Save this content开发者_开发问答 to file programmatically.
Notes: I use .net 2.0 and C#.
Thanks.
I have used EPPlus for .xlsx reading/writing and it has worked great
I think the only way to achieve this without having Excel installed is to just write the file format directly. Microsoft documented the file format a few years ago. You can find them at http://msdn.microsoft.com/en-us/library/cc313118.aspx.
Update I've just found EPPlus. Check it out at http://epplus.codeplex.com/
You can use an ODBC or OLE connector to read and write an Excel file. However, I am not sure if you can create a file with it, you might need to keep a dummy-empty file with the correct layout.
Update: It is, accordingly to comment below from @Joel Gauvreau possible to create an excel file using this technique.
Links: http://support.microsoft.com/kb/257819
http://www.codeguru.com/cpp/data/mfc_database/microsoftexcel/article.php/c1131
精彩评论