Free Support Forum - aspose.com

Mail merge QR Code resolved to Image setting wrap type to NONE not INLINE


#1

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


#2

@woody992,

To ensure a timely and accurate response, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Aspose.Words 19.3 generated output document showing the undesired behavior
  • Your expected document showing the correct output. You can create expected document by using MS Word.
  • Please also create a simplified standalone Java application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words JAR files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.


#3

Thanks, Awais

It appears to be fixed in the later version, not sure which, I’ve just jumped from 18.2 to 19.2 or Words and Barcode.

Is 19.3 available as I couldn’t find it to download?

Thanks

Stuart


#4

@woody992,

Yes, it is available and you can get it from the following link:

https://downloads.aspose.com/words/java


#5

Aspose.Total appears to contain 19.2 still, is this correct?


#6

Also, have you got an updated version of the following document that doesn’t use BarCodeBuilder as this has now been deprecated?

https://docs.aspose.com/display/wordsnet/How+to+Generate+a+Custom+BarCode+Image+for+DISPLAYBARCODE+Field


#7

@woody992

We have updated the code example provided at this link:
https://docs.aspose.com/display/wordsnet/How+to+Generate+a+Custom+BarCode+Image+for+DISPLAYBARCODE+Field

Please feel free to write back to us if you have further queries or if you need any additional information.


#8

@woody992,

We have also updated the Aspose.Total for Java package and now it contains 19.3 version of Aspose.Words for Java. We apologize for any inconvenience.


#9

Thank you. Your help has been much appreciated.