Hello,
I'm trying to add a new includepicture in the document as a result of a mergefield. to explain my idea :
Let's suppose that we have a document with the merge field
{MERGEFILED LOGO \* MERGEFORMAT }
and
LOGO = { INCLUDEPICTURE "c:/...logo.jpg" }
So I tried this :
LoadOptions options = new LoadOptions();
options.setLoadFormat(LoadFormat.DOCX);
options.setPreserveIncludePictureField(Boolean.TRUE);
Document document = new Document(templateInputStream, options );
FieldIncludePicture includePicture = new FieldIncludePicture();
includePicture.setSourceFullName("c:/...logo.jpg");
document.getMailMerge().execute(new String[]{"LOGO"},
new Object[]{includePicture });
but I'm having a null pointer exception :
java.lang.NullPointerException
at com.aspose.words.Field.getStart(Unknown Source)
at com.aspose.words.Field.getType(Unknown Source)
at com.aspose.words.zz6M.(Unknown Source)
at com.aspose.words.Field.zz6P(Unknown Source)
at com.aspose.words.Field.zz6N(Unknown Source)
at com.aspose.words.Field.zz6w(Unknown Source)
at com.aspose.words.FieldIncludePicture.setSourceFullName(Unknown Source)
The problem is that in my word document, I'm having a mergefield that I must convert to includepicture without modifying the word template (I can't add mergefield with include picture in the word template).
Thank you for your help.