Hi,
I wanted to export data from grid view to my own format excel sheet.I have a code to export to a new workbook,but i`m getting problem with exporting to our companies standard excel sheet format that already contain header,footer and body design.Please help with code how to add data from grid view to existing file??
Here is my code in button_Click event:
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.Cells[1, 1] = "Slno";
ws.Cells[1, 2] = "code";
ws.Cells[1, 3] = "name";
ws.Cells[2, 1] = TextBox1.Text;
ws.Cells[2, 2] = TextBox2.Text;
ws.Cells[2, 3] = TextBox3.Text;