I wrote code like this for excel.
Microsoft.Office.Interop.Excel.Application xla = new Microsoft.Office.Interop.Excel.Application();
Workbook vb = xla.Workbooks.Add(XlSheetType.xlWorksheet);
Worksheet ws = (Worksheet)xla.ActiveSheet;
xla.Visible = true;
How can i add a new sheet to workbook??
Darma
How can i add a new sheet to workbook??
Darma
George ericPosted Jul 20, 2012, 1:36 AM
Check my codes:
Microsoft.Office.Interop.Excel.Application xla = new Microsoft.Office.Interop.Excel.Application();
Workbook vb = xla.Workbooks.Add(XlSheetType.xlWorksheet);
Worksheet ws = (Worksheet)xla.ActiveSheet;
xla.Visible = true;
ws = (Worksheet)vb.Worksheets.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing);
vb.SaveAs("result.xls");
The Bold line is how to add worksheet.
Also I will direct you to C# Excel skills