I had tried the following code, But it is throwing a fatal error saying it could not able to load
excel DLL even after adding it in reference.
Excel.
Excel.Workbooks workbooks = excel.Workbooks;
Excel.Workbook workbook = workbooks.Add(true);
excel.Cells[0,0] = "TestData";
Excel.Worksheet worksheet = (Excel.Worksheet)excel.ActiveSheet;
excel.Visible = true;
calinPosted Apr 23, 2007, 11:08 AM
you are doing it wrong.
Use Excel.Application app = new Excel.Application();
Sometimes there are errors when using Excel, so it would be good to insert this code at the begining:
Excel.Application app = null;
System.Globalization.CultureInfo oldCI = System.Threading.Thread.CurrentThread.CurrentCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
app = new Excel.Application();