This project has moved and is read-only. For the latest updates, please go here.

Exception "Factory is not initialized with NetOffice assemblies"

May 10, 2016 at 11:40 AM

I'm attempting to utilise this wonderful NetOffice wrapper in a Microsoft Dynamics CRM plugin. Now I know this may be beyond the realms of possibility, however direct Excel COM integration has previously been achieved so I was hoping that this would work. It would be great to be able to use NetOffice to both achieve Excel version independence and also automatic COM proxy management.

When I run NetOffice code I'm currently receiving the following exception:

Exception of type: NetOfficeException
Message: Factory is not initialized with NetOffice assemblies.
StackTrace: at NetOffice.Core.GetFactoryInfo(Object comProxy)
at NetOffice.Core.CreateObjectFromComProxy(COMObject caller, Object comProxy)
at NetOffice.ExcelApi.Sheets.get_Item(Object index)
at Sam7.Hyundai.EntityPlugins.Implementation.OfficeExcel.SaveTo(String outputFilePath)

A bit of background regarding Microsoft Dynamics CRM plugins: Each is a C#.Net assembly run in a server environment, on the machine that runs the CRM system and require everything to be in a single DLL. To achieve this I've bundled all the following - ExcelApi.dll, OfficeApi.dll, VBIDEApi.dll, NetOffice.dll - into the resultant DLL using "ILMerge". This may indeed be the cause of the above exception, however I'm not sure what NetOffice assemblies the "Factory" is talking about. It may be that there's another dependency that is required for successful operation. Alternatively, I may just not be able to do what I'm attempting.

I would really appreciate any help or advice on fault finding the above issue please.

Many thanks, Andy.