Reputation: 6500
I'm using Office Interop for Excel Version 15.0.0.0
There is no option to create a workbook from an Existing File.The old sample code uses the following method to create a workbook
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"D:\MyExcel\SurfaceSample.xls");
This method --> LoadFromFile
has been removed from the current library,also the open
method is a delegate.I have refereed the documentation but cannot find a relevant method.
Upvotes: 0
Views: 1855
Reputation: 25663
The Office object models don't work the same as those of the .NET Framework. For one thing, the New
keyword should never be used for anything except the Application
.
In order to create a new object (copy) from an existing file, Office applications provide the Add
method. So something more like:
Workbook wb = xlApp.Workbooks.Add(filePathToTemplate);
Upvotes: 2