Posted on: 7/22/2015 6:49:11 PM | Views : 752

Hi friends.
I have a  data table  which can have n number of rows.
Basically I want to loop through the data table and  add some of the field data to an existing excel template
Say for suppose The datatable has three rows,  I now have to add two more sheets of the Sheet 1 of the excelworkbook making the total to three.
So for n rows , I need n-1 sheets  of the Sheet1 in the same work book.   This what I have so far....
Can someone get me to iterate properly ..Thank You
try { string DestinationPath = @"C:\Test\Test20.xls"; object misValue = System.Reflection.Missing.Value; Application app = new Application(); string execPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); File.Copy(@"C:\Test\cust.xls", DestinationPath); Workbooks workbooks = app.Workbooks; ...

Go to the complete details ...