Sunday, 19 March 2017

c# create instance of Excel workbook from console application

I have a Visual Studio solution that contains two projects (1) a C# console application; and (2) a C# Excel Workbook.



The console application creates some data, which I would then like to pass into the workbook.



To do this I have created a method in the Excel workbook project, which receives data from the console application. However, I cannot create an instance of the Excel book. At the moment I am trying:



Excel.Application excelApplication = new Excel.Application();
Excel.Workbook excelWorkBook = excelApplication.Workbooks.Add("MyBook.xls");



I could hard code the path to the xls file, but I don't really want to do this as I would prefer to wrap everything up into a single .exe




Any ideas?

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...