使用C#将数据导出到Excel(包括格式化) [英] Export data to Excel (including formatting) using C#
问题描述
问题是这个 - 软件运行的计算机没有Excel。所以我不能下去调用Excel api的路线。
有没有一个简单的方法,我错过了?如果没有,是发布Excel文件的格式还是如何达到这个目标?
谢谢。
编辑:
对于有兴趣的其他人,我最终发现这篇文章,它提供了我发现的最简单的方法。使用Excel 2003。
哪个版本的excel?
如果您需要excel 2003,请查看:
http:// www.carlosag.net/Tools/ExcelXmlWriter/
如果你和excel 2007一样,那就是:
http://excelpackage.codeplex.com/ (开源)
或
http://msdn.microsoft.com/en-us/library/bb448854.aspx (官方MS产品)
I have a DataTable in my program which I have previously exported to excel using a CSV file. However, I want to conditionally format the backgroun colour of cells - which obviously needs a new approach.
The issue is this - the computer where the software will run does not have Excel. So I cannot go down the route of calling the Excel api.
Is there an easy way of doing this that I have missed? If not, is the format of Excel files published or how can I achieve this goal?
Thanks.
EDIT:
For anyone else that is interested, I eventually found this post which provides the simplest method I have found. Works with Excel 2003.
Which version of excel? If you need excel 2003, then take a look at : http://www.carlosag.net/Tools/ExcelXmlWriter/
If you're ok with excel 2007, then there's: http://excelpackage.codeplex.com/ (open source) or http://msdn.microsoft.com/en-us/library/bb448854.aspx (official MS product)
这篇关于使用C#将数据导出到Excel(包括格式化)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!