在c#中使用excel文件 [英] working with excel file in c#
问题描述
这对于在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, 这篇关于在c#中使用excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
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
JohnRange is a Range[^] - always, unless... ;)
Here is what you're looking for: Working with Worksheets[^] ;)Read this Article. It will help you.