NetOffice 1.7.2: ComFactory initialization

Jan 14, 2015 at 2:04 PM
Hi Guys

I'm coming from NetOffice 1.6 and asked myself how to initialize the ComFactory?
I've got an Addin that is used for all Office Products (Outlook, Word, Excel, Powerpoint)

In 1.6 i could use the following to initialize the ComObject:

Factory.Initialize();
COMObject Appl = Factory.CreateObjectFromComProxy(null, application);
MessageBox.Show(Appl.UnderlyingComponentName);

How does this work in 1.7.2?
Coordinator
Jan 14, 2015 at 3:13 PM
hello,

Factory has been renamed to Core and use a singleton instance by default.

NetOffice.Core.Default.CreateObjectFromComProxy(null, application);

You can create multiple core's now to get multiple COM proxy tree's
Each NetOffice Tools based addin has an own core. (this.Factory)

This breaking change want handle the problem that all unshimmed COM-Addins
was loaded from office in the same appdomain. so you have 2 addin.dll's loaded(based on NetOffice)
both addins share the static factory core and its stettings and this cause unwanted side effects.


*Sebastian
Jan 15, 2015 at 5:41 AM
Ah cool, works like a charm, thanks!