Click here to Skip to main content
16,004,653 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

Is this really necessary to do all this stuff for initializing a workbook 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;

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

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

I tried something like this

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


Thanks
John
Posted
Updated 29-Nov-13 6:25am
v2

Read this Article. It will help you.
 
Share this answer
 
Range is a Range[^] - always, unless... ;)
Here is what you're looking for: Working with Worksheets[^] ;)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900