Free Support Forum -

Setting Image Size when inserting an Image into a Word document

We are using merge fields within a Word document to create word documents dynamically through a template. We are having trouble ensuring a chart (which is in PNG format) is properly sized when the template is populated.

What options are available for setting the dimensions of an Image when using Aspose Words with merge fields?

I've attached the template with the image merge field definition.


Thanks for your request. I think, in your case you can try using FieldMergingCallback. Please see the following forum thread to learn how to achieve what you need during MailMerge:

Best regards,

I would like to clarify this posting. We would like to know if there is a way to retain the width and height settings that are already specified for the image in the template. We want to avoid additional coding and want the Aspose library to honor the settings specified in the template.

Hi Brian,

Thanks for this additional information.

No, there is no way for the inserted image to inherit the size of the Shape within the current field. However you can easily code this using the handler suggested by Andrey above.