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

Free Support Forum - aspose.com

Word MailMerge- How do to set Image Size?

I have word template which has image field. The name of the field is "Signature". I'm NOT using IFieldMergingCallback interface to set the actual value, instead the DataTable has a column with the name same as field name "Signature", and data type is byte array. so everything works fine when i call Execute method. But sometime the actual image is large

how do i set the size of that image field?

Hi,


Thanks for your inquiry. You can set the width/height of images by using DocumentBuilder.InsertImage method during mail merge. Please see the following code snippet:

private class HandleMergeImageFieldFromBlob : IFieldMergingCallback
{
void IFieldMergingCallback.FieldMerging(FieldMergingArgs e)
{
}
public void
ImageFieldMerging(
ImageFieldMergingArgs
args)
{
if (args.FieldName.Equals(“testField”))
{
DocumentBuilder builder = new
DocumentBuilder(args.Document);
builder.MoveToMergeField(args.FieldName);

builder.InsertImage(args.FieldValue.ToString(), 200, 200);
}
}
}

Moreover, you can find documentation of DocumentBuilder.InsertImage method overloads here:
http://docs.aspose.com/display/wordsnet/InsertImage+Method

I hope, this will help.

Best Regards,