Hi Arnaud,
Â
You can use the NetOffice interop libraries with Excel-DNA, but you need not. You can reference the Excel interop assemblies directly, and use the ‘Embed Interop Types’ option so that you don’t have to distribute extra assemblies.
Â
There is a NuGet package called ExcelDna.Interop that install the Excel 2010 interop assemlbies. With this you can target any version of Excel, but only use the parts of the COM object model that are available in Excel 2010.
Â
In my understanding, NetOffice gives you the union of COM features (all the types and members from all versions) although on a particular Excel version of course only the available features will work.
Also NetOffice has IntelliSense help that indicates which Excel versions support a particular member. That helps a lot if you want to target different versions, and has some features light up on a newer version.
Â
I don’t know that NetOffice provides any extra support for binding ListObjects beyond the COM support.
The VSTO libraries (called Microsoft.Office.Tools.XXX) provide a wonderful extensions on top of the COM object model to bind to ListObjects, to receive events etc.
Â
However, you can’t use the VSTO library together with Excel-DNA, so you would have to re-implement the binding and event features yourself. This would be a nice open-source project or extension to Excel-DNA!
Â
My suggestion is to reference the standard interop assemblies (either directly by Add Reference…, or by installing the ExcelDna.Interop package) and build on top of that.
Â
Remember that to get hold of the root Application COM object in your Excel-DNA add-in, you should call ExcelDnaUtil.Application. And never under any circumstances to do any COM work from another thread or Task running on the ThreadPool.
Â
-Govert
--
<configSections>
<section name="MyCustomConfig" type="MyAddIn.MyCustomConfigSection, MyAddIn" />
</configSections>Â
<MyCustomConfig>
</MyCustomConfig>
Â
Â
To post to this group, send email to exc...@googlegroups.com.
Hi Ken,
Â
I would expect an exception because the .NET configuration manager attempts to load the assembly (MyAddIn.dll) and when that fails with the exception you see in the debugger, we expect .NET to call the add-in’s AssemblyResolve event which will get the packed assembly. So we expect a first-time exception even in the case where it should work.
It’s not clear from your message whether you’ve tried without the debugger.
Â
The issue about putting the packed file in a separate directory, is that otherwise the MyAddIn.dll will be loaded twice into the AppDomain – once from the packed binary data and once by the ConfigurationManager from the actual file. You’ll then end up with unexpected errors due to there being distinct copies of the ‘same’ type.
Â
I’m not sure whether the packing works with custom configSections, but the earlier messages in this thread, and an example using NLog, indicate that it should.
Â
If you still have trouble you might make a small example with all the right bits and post to GitHub – that would give an easy start to having a closer look.
Â
-Govert
Â
Â
From: exce...@googlegroups.com [mailto:exce...@googlegroups.com] On Behalf Of Ken
Sent: 4 August 2017 03:02
To: Excel-DNA <exce...@googlegroups.com>
To post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.