Need to work with Excel automation using C#.
There is no Visual Studio installation, and can't be done. But Ms-Office 2007 is installed at workstation.
While using csc.exe for compilation, getting errors, because of Microsoft.Office assembly.
I tried searching at general locations, but could not locate dll file.
using Microsoft.Office.Interop.Excel;
using Excel = Microsoft.Office.Interop.Excel;
/// no files found
/// assembly paths ; C:\Windows\assembly\Microsoft.Office.Interop.Excel
/// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5
class Program
{
static void Main(string[] args)
{
var excelApp = new Excel.Application();
excelApp.Workbooks.Add();
// Insert VBA code here.
excelApp.Visible = true;
}
}
you can reference the DLL which is located in the GAC csc /recurse:* /r:"C:\windows\assembly\GAC_MSIL\Microsoft.Office.Inte 5.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll"
Depending on you office version you have eventually to change the path a bit