Updating INCLUDEPICTURE / REF fields

Hi,
we create a .docx document based on a template. The template contains the following structure:
{ SET picName "http://some.url/icon_{MERGEFIELD Test_MergeField \* MERGEFORMAT}.jpg" } {INCLUDEPICTURE { REF picName } \* MERGEFORMAT}

This is supposed to insert an image into the document, whose URL is built by merge field, depending on the specified value. Merge field is filled in when creating the document and it looks correct in the resulting document:
{ SET picName "http://some.url/icon_test.jpg" } {INCLUDEPICTURE { REF picName } \* MERGEFORMAT}

However, the image does not display correctly, and instead you see the text

Error! Filename not specified.

This can be fixed manually by right click and updating the REF field, or by using a macro in the document:

Private Sub Document_Open()
   ActiveDocument.Fields.Update
End Sub

Is it possible to do such an update using Aspose.Words?
doc.UpdateFields() has no effect here, using “loadOptions.PreserveIncludePictureField = true;” doesn’t seem to have any effect either.

Best regards,
Artur

@ARTJ I cannot reproduce the problem on my side. Here is a simple test code, template and output documents:

LoadOptions opt = new LoadOptions();
opt.PreserveIncludePictureField = true;
Document doc = new Document(@"C:\Temp\in.docx", opt);
doc.MailMerge.Execute(new string[] {"test" }, new object[] { @"https://cms.admin.containerize.com/templates/aspose/App_Themes/V3/images/aspose-logo.png" });
doc.Save(@"C:\Temp\out.docx");

in.docx (12.6 KB)
out.docx (13.7 KB)

If your goal is to insert image upon executing mail merge, you can use merge fields with special names Image:FieldName. For example see another template and output:

Document doc = new Document(@"C:\Temp\in_image_field.docx");
doc.MailMerge.Execute(new string[] {"test" }, new object[] { @"https://cms.admin.containerize.com/templates/aspose/App_Themes/V3/images/aspose-logo.png" });
doc.Save(@"C:\Temp\in_image_field_out.docx");

in_image_field.docx (12.5 KB)
in_image_field_out.docx (13.2 KB)