Hi
I am attempting to perform mail merges that include QR codes via Words’ MERGEBARCODE field. When the mail merge is performed it correctly results in a DISPLAYBARCODE field. However, I then want that to be resolved to a fixed image. Therefore, I have applied some post processing to the mail merged document to unlink the DISPLAYBARCODE field such that it resolves it to an image using a CustomBarcodeGenerator (as per https://docs.aspose.com/display/wordsnet/How+to+Generate+a+Custom+BarCode+Image+for+DISPLAYBARCODE+Field).
So far I have the following code:
final Document template = new Document(new ByteArrayInputStream(bytes));
template.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_EMPTY_PARAGRAPHS);
template.getMailMerge().execute(customDataSource);
template.getFieldOptions().setBarcodeGenerator(new CustomBarcodeGenerator());
for(FieldChar fieldStart :(Iterable<FieldChar>)template.getChildNodes(NodeType.FIELD_START, true)) {
if(FieldType.FIELD_DISPLAY_BARCODE == fieldStart.getFieldType()) {
fieldStart.getField().unlink();
}
}
template.save(outputStream, AsposeMediaType.getMediaType(targetContentType));
This works fine in regards to the generation of the barcode image.
However, the WrapType has ended up as WrapType.NONE and I require it to be WrapType.INLINE. So far I have been unable to find a way to reliably set the wrapType on just the Shape of the QR code image.
Any advice on how I can achieve setting the wrapType on just the QR code image and not any other images or Shape objects within the document?
I am currently using Aspose.Words and Asport.Carcode 18.2 for Java.
Thank you
Regards
Stuart