C#
Prior to running this code, you will need to follow these steps in
using Excel=Microsoft.Office.Interop.Excel; class Program { static void Main(string[] args) { Excel.Application objExcel=new Excel.Application(); //Excel.Worksheet objWks; try { objExcel.Visible=true; var objWb = objExcel.Workbooks.Add(); Excel.Worksheet objWks = objWb.Worksheets[1] as Excel.Worksheet; objWks.Cells[1, 1].value = 1; } catch(Exception ex) { Console.WriteLine(ex.Message); } finally { if (objExcel !=null) { objExcel=null; } } } }
No comments:
Post a Comment