Hello,
I am currently having issues with the following code when trying to create a excel file using C#. This is the code that I have at the moment.
The line that I am having issues with is
If I remove it, I am able to create and save teh workbook in the directory. However, I want to make some changes on a worksheet, and that is where the issue is. I have also tried using the line of code:
. This line hade no luck either. The issue I am having is the error regarding InvalidOperatio nException: Dynamic operations can only be performed in homogenous AppDomain.
Any help would be greatly appreciated.
I am currently having issues with the following code when trying to create a excel file using C#. This is the code that I have at the moment.
Code:
oXL = new Microsoft.Office.Interop.Excel.Application(); oXL.Visible = false; oWK = (Microsoft.Office.Interop.Excel._Workbook)(oXL.Workbooks.Add(System.Reflection.Missing.Value)); oWK.SaveAs(path + "\\" + fileName); oWS = (Microsoft.Office.Interop.Excel._Worksheet)oWK.Worksheets.get_Item(1); oWS.Cells[1, 1] = "Student ID"; oWS.Cells[1, 2] = "Student Name"; oWK.Save();
Code:
oWS = (Microsoft.Office.Interop.Excel._Worksheet)oWK.Worksheets.get_Item(1);
Code:
oWS = (Microsoft.Office.Interop.Excel._Worksheet)oWK.Worksheets[1];
Any help would be greatly appreciated.
Comment