Add a reference to Excel under Project menu Add Reference. Under the COM tab and select Excel of the version to be used.
Add the following two lines to the directive at the top of the form code.
using Excel = Microsoft.Office.Interop.Excel;
using System.Reflection;
Inside your clickevent:
private void button1_Click(object sender, EventArgs e)
{
Excel.Application Exceluygulama;
Excel.Workbook Excelkitap;
Excel.Worksheet Excelsayfa;
try
{
Exceluygulama = new Excel.Application();
Exceluygulama.Visible = true;
Excelkitap = (Excel.Workbook)(Exceluygulama.Workbooks.Add(Missing.Value));
Excelsayfa = (Excel.Worksheet)Excelkitap.ActiveSheet;
Excelsayfa.Shapes.AddPicture("C:\\MyPic.Bmp", Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 425, 130, 100, 125);
Exceluygulama.Cells[5, 5] = "Text Item 1";
Exceluygulama.Cells[8, 10] = DateTime.Now.ToShortDateString();
Exceluygulama.Cells[16, 4] = "Text Item 2";
}
catch
{
}
}
The numbers at the end of the
AddPicture
are the Left, Top, Width and Height of the picture. You will need to size and locate he picture so that you can place the picture over the Cell(10,10) location.
There is more information here:
http://support.microsoft.com/kb/302084[
^]
You should be able to navigate the workbook, copy paste etc. using cell referencing.
Regards.