I'm trying out NetOffice to perform MS Word mail merge using a template and programatically filling in the merge fields. The examples available here does not really have this scenario. I updated Example 03 in it so that it creates a new document from an existing MS Word document with merge fields. I then changed it to access the merge fields using the code below:
var fields = newDocument.MailMerge.Fields;
foreach (Word.MailMergeField field in fields)
{
...
}
But the for loop gets this exception the first time it tries to enumerate through fields: Factory is not initialized with NetOffice assemblies. If I try to run on debug, fields.Count returns a correct count of the merge fields on my document. I just can't seem to access the fields to fill/update them.
Has anyone encountered this before?
UPDATE
Running a debug on Core.cs, it fails to load the assembly from WordApi.dll, and consequently does not get the FactoryInfo from that assembly, which I assume it needs in its _factoryList. I haven't quite figured out why it is failing to load the assembly even when the dll is in the folder that it is searching in.
Dim oAccounts = oOutlook.Session.Accounts. I switched to the FW version of the package and it worked. What's the difference between the two, and may I ask why you chose not to publish the update/fix to the non-FW version?