Workbook doc;
doc = excelApp.Workbooks.Open(strExcelFilePath); SnapShot_ReporTgenerator_BackGroundWorker.ReportProgress(70); //"Creating file..." Microsoft.Office.Interop.Excel.Sheets workSheets = doc.Worksheets; int listCount = 1; for (int i = 1; i <= list.Count; i++) { //code to create diffrent excel sheets var xlsNewSheet = (Microsoft.Office.Interop.Excel.Worksheet)workSheets.Add(Missing.Value, workSheets[i], Missing.Value, Missing.Value); xlsNewSheet.Name = i + "of" + list.Count; foreach (var sublist in list) { if (listCount == i) { System.Data.DataTable table = TODataTable<string>(sublist); doc.Worksheets.Add(table, xlsNewSheet.Name); //code to add datatable to worksheets } listCount++; } } doc.SaveAs(strExcelFilePath); ForMat_SnapShotReport(doc); excelApp.Visible = true;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)