Should try something like that :
private void Export_Click(object sender, EventArgs e)
{
this.CopyGridToClipboard(dataGridView1);
Microsoft.Office.Interop.Excel.Application application;
Microsoft.Office.Interop.Excel.Workbook book;
Microsoft.Office.Interop.Excel.Worksheet sheet;
application = new Microsoft.Office.Interop.Excel.Application();
application.Visible = true;
book = application.Workbooks.Open("C:\\Doc1.xlsx");
sheet = (Microsoft.Office.Interop.Excel.Worksheet)
book.Worksheets.get_Item(1);
Microsoft.Office.Interop.Excel.Range gridRange = Microsoft.Office.Interop.Excel.Range)sheet.Cells[9, 1];
gridRange.Select();
sheet.PasteSpecial(gridRange);
this.CopyGridToClipboard(dataGridView1);
Microsoft.Office.Interop.Excel.Range gridRange = Microsoft.Office.Interop.Excel.Range)sheet.Cells[20, 1];
gridRange.Select();
sheet.PasteSpecial(gridRange);
this.CopyGridToClipboard(dataGridView1);
Microsoft.Office.Interop.Excel.Range gridRange = Microsoft.Office.Interop.Excel.Range)sheet.Cells[30, 1];
gridRange.Select();
sheet.PasteSpecial(gridRange);
}
not tested :)
possible bug : the lonely
)
is highly suspect.
Microsoft.Office.Interop.Excel.Range gridRange = Microsoft.Office.Interop.Excel.Range)sheet.Cells[20, 1];