C#合并excel多张工作表和拆分工作表

evilhope 2010-09-29 10:13:56
rt:用C#合并一张excel里面的多张工作表 到一张工作表里,可以合并到一张新的excel文件里....
拆分正好相反...
...全文
1036 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
linwanhai 2010-10-08
  • 打赏
  • 举报
回复
这不难啊,网上一大堆怎么读取写入Excel文件的代码
cjh200102 2010-09-30
  • 打赏
  • 举报
回复
关注。
wuyq11 2010-09-29
  • 打赏
  • 举报
回复
Excel.Application app = new Excel.ApplicationClass();
app.Visible = true;
Excel.Workbook workBook = app.Workbooks.Open(templetFile,missing,missing,missing,missing,missing,missing,missing,missing,missing,missing,missing,missing);
Excel.Worksheet workSheet = (Excel.Worksheet)workBook.Sheets.get_Item(1);
for(int i=1;i<sheetCount;i++)
{
((Excel.Worksheet)workBook.Worksheets.get_Item(i)).Copy(missing,workBook.Worksheets[i]);
}
循环获取sheet添加workBook.Worksheets里
再遍历生成excel
Teng_s2000 2010-09-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 computerfox 的回复:]
用VSTO编程,根据合并和拆分规则,将数据读取出来,再写入,参考资料:
1、使用 Visual Studio 2005 Tools for Office (VSTO)开发C# Excel 程序
http://www.cnblogs.com/sunrack/articles/828500.html
2、A Complete Excel Programming Sample
3、ExcelML……
[/Quote]
NB
fairy9999 2010-09-29
  • 打赏
  • 举报
回复
i can't input chinese
1 if the excel files is EXCEL2003 format ,you can using NPOI or COM
2 if the excel files is EXCEL2007,you can using OPEN XML SDK
fangxiaofelix 2010-09-29
  • 打赏
  • 举报
回复
帮你顶下,提供一些思路,不知道楼主有没有做过Excel导入、导出。如果做过的话,可以试试看,先把需要整合的Excel导入,把需要整合的sheet表进行数据处理,然后重新生成Excel导出来
evilhope 2010-09-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 computerfox 的回复:]

用VSTO编程,根据合并和拆分规则,将数据读取出来,再写入,参考资料:
1、使用 Visual Studio 2005 Tools for Office (VSTO)开发C# Excel 程序
http://www.cnblogs.com/sunrack/articles/828500.html
2、A Complete Excel Programming Sample

3、Excel……
[/Quote]
大哥第2个链接没用啊
捷哥1999 2010-09-29
  • 打赏
  • 举报
回复
用VSTO编程,根据合并和拆分规则,将数据读取出来,再写入,参考资料:
1、使用 Visual Studio 2005 Tools for Office (VSTO)开发C# Excel 程序
http://www.cnblogs.com/sunrack/articles/828500.html
2、A Complete Excel Programming Sample
[url=http://www.codeproject.com/KB/office/ExcelProgrammingSample.aspx[/url]
3、ExcelML Templates Editor – data visualization using Office 2003 SpreadsheetML features
[url=http://www.codeproject.com/KB/office/excelml_template.aspx[/url]
cymIT 2010-09-29
  • 打赏
  • 举报
回复
不知道用C#调用VBA行不行...
gsli 2010-09-29
  • 打赏
  • 举报
回复
学习学习

110,532

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧