We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Is it possible to set the WrapType for an image MergeField

Is there any way to specify the WrapType for an image mergefield? Or is there any way to set the default wraptype? It seems the default is WrapType.INLINE but I would like to use WrapType.SQUARE.

I know I can set the image size like this:


Do you want to meet this requirement by using the LINQ Reporting Engine or by using the regular Mail Merge and Reporting functionalities of Aspose.Words for Java?

Please also ZIP and upload your simplified input template Word document and your expected output document showing the desired behavior here for testing. You can create expected document by using MS Word. We will then investigate the scenario further on our end and provide you more information.

Thanks for your quick reply.
In the attachment you’ll find the template, the the actual result of the mailmerge (the wraptype of the inserted image is ‘inline’) and the expected/wanted result (wrap type is ‘square’).

I am using MailMerge with the following settings:

            .apply {
                useNonMergeFields = true
                trimWhitespaces = false
                useWholeParagraphAsRegion = false
                cleanupOptions = MailMergeCleanupOptions.REMOVE_EMPTY_TABLE_ROWS
                fieldMergingCallback = fieldMergingHandler

The fieldMergingCallback fieldMergingHandler sets the imageFieldMergingArgs.imageStream to the contents of an image in imageFieldMerging.
aspose forum.zip (75.5 KB)


I understand what you are trying to achieve. Generally, you would need to obtain the Shape object and then set Shape.setWrapType(WrapType.SQUARE). But, can you please create a standalone simple runnable 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. We will then investigate the scenario further on our end and provide you more information. Thanks for your cooperation.

@awais.hafeez Please find attached the requested simple Java applicationwraptype-java.zip (33.2 KB)


We are checking this scenario and will get back to you soon.


We have logged your requirement in our issue tracking system. Your ticket number is WORDSNET-19568. We will further look into the details of this requirement and will keep you updated on the status of the linked issue. We apologize for your inconvenience.

1 Like

The issues you have found earlier (filed as WORDSNET-19568) have been fixed in this Aspose.Words for .NET 20.3 update and this Aspose.Words for Java 20.3 update.