I am trying to write some data into excel sheets using c#.
so far i have written the following code. But i am not able to proceed further
Expand|Select|Wrap|Line Numbers
- Microsoft.Office.Interop.Excel.ApplicationClass appExcel =
- new Microsoft.Office.Interop.Excel.ApplicationClass();
- try
- {
- Workbook newWorkbook = null;
- // is there already such a file ?
- if (System.IO.File.Exists("C:\\csharp\\errorreport1.xls"))
- {
- // then go and load this into excel
- newWorkbook = appExcel.Workbooks.Open("C:\\csharp\\errorreport1.xls",
- true, false, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
- Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
- Missing.Value, Missing.Value, Missing.Value);
- }
- else
- {
- // if not go and create a workbook:
- newWorkbook = appExcel.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
- }
- objsheet.Cells[i, j].Value = value;