在c#中使用excel文件 [英] working with excel file in c#

查看:95
本文介绍了在c#中使用excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





这对于在c中初始化工作簿来完成所有这些工作真的很有必要吗#



  object  misValue = System.Reflection.Missing.Value; 
Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkBook = xlApp.Workbooks.Add(misValue);
Excel.Worksheet xlWorkSheet1 =(Excel.Worksheet)xlWorkBook.Worksheets.get_Item( 1 );
Excel._Worksheet xlWorksheet1 = xlWorkBook.Sheets [ 1 ];
Excel.Range xlRange1 = xlWorksheet1.UsedRange;



这个Excel.Range命令会做什么???



如何将新工作表添加到工作簿中???



我试过这样的事情



 Excel._Worksheet xlWorksheet2 = xlWorkBook.Sheets [ 2 ]; 





谢谢

John

解决方案

范围是范围 [ ^ ] - 总是,除非......;)

以下是您要找的内容:使用工作表 [ ^ ];)


阅读本文。它会对你有帮助。


Hi,

Is this really necessary to do all this stuff for initializing a workbook in c#

object misValue = System.Reflection.Missing.Value;
Excel.Application xlApp = new Excel.Application();
Excel.Workbook xlWorkBook = xlApp.Workbooks.Add(misValue);
Excel.Worksheet xlWorkSheet1 = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
Excel._Worksheet xlWorksheet1 = xlWorkBook.Sheets[1];
Excel.Range xlRange1 = xlWorksheet1.UsedRange;


what is this Excel.Range command will do???

How to add new work sheet to work book???

I tried something like this

Excel._Worksheet xlWorksheet2 = xlWorkBook.Sheets[2];



Thanks
John

解决方案

Range is a Range[^] - always, unless... ;)
Here is what you're looking for: Working with Worksheets[^] ;)


Read this Article. It will help you.


这篇关于在c#中使用excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆