如何使用c#合并两个excel文件
问题描述:
我想合并两个excel文件:
第一个文件:
ID名称
1 Mary
2 Tom
3 Mai
第二档:
ID Mark
1 89
2 67
3 56
i想要输出的是excel文件,就像那样:
ID名称标记
1 Mary 89
2 Tom 67
3 Mai 56
I want to merge two excel files in one:
the first file:
ID Name
1 Mary
2 Tom
3 Mai
the second file:
ID Mark
1 89
2 67
3 56
i want the out put is excel file which is like that:
ID Name Mark
1 Mary 89
2 Tom 67
3 Mai 56
how can i do this in c#?
答
如果这些是* .XLSX文件,你可以使用,你可以使用Open XML SDK:
http://www.microsoft.com/en-us/download/details.aspx?id=30425 [ ^ ]。
这样,你可以支持新的基于XML的Office格式(如.DOCX,.XLSX),ECMA-376标准:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats [ ^ ],
http://en.wikipedia.org/wiki/Office_Open_XML [ ^ ]。
这样,您可以在没有安装Office的情况下工作。此外,第三方软件支持这些文档。请查看我过去的答案:
将Office文档转换为PDF而不互操作 [ ^ ],>
需要一个相当独特的WPF文本编辑器控件 [ ^ ],
您好如何使用c#.net 在Windows应用程序中显示word文件[ ^ ],
阅读没有使用Interop.word dll的word文件...不想在IIS中安装单词。 [ ^ ]。
这是另一种选择: http://npoi.codeplex.com/ [ ^ ]。-SA
If those are *.XLSX files, you can use , you can use Open XML SDK:
http://www.microsoft.com/en-us/download/details.aspx?id=30425[^].
This way, you can support new XML-based Office formats (such as .DOCX, .XLSX), ECMA-376 standard:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].
This way, you can work without Office installed. Also, the documents are supported by 3rd-party software. Please see my past answers:
Convert Office-Documents to PDF without interop[^],
Need a rather unique WPF text editor control[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].
This is another option: http://npoi.codeplex.com/[^].—SA