Free Support Forum - aspose.com

How to specify the size for a image mergefield

Evaluating ASPOSE word component to merge worddocuments with a dataset.

Hi,

Situation : User will make up the word templates using mergefields. Some of the mergefields are pictures. The pictures have different sizes. But they should by scaled to a size the user should choose.

Is there a way that the user can specify the size of the picture in the wordtemplate. Can this be done by putting some kind of picture placeholder in de document.

I see that in the demo EmployeesReportDemo.doc a mergefield ?Image:PhotoBLOB? is used. But the user who makes up the template only sees the tag but can not specify the size of the picture.

We do not want to resize the pictures in advance to preserve the optimal quality.

I do the merge with following code :

oDoc = new Aspose.Word.Document(DirectoryStart + TemplateFileName);
oDoc.MailMerge.ExecuteWithRegions(oDT);

where oDT is a DataTable with the datarecords containing pictures. But the size of the pictures in it is not always the same size for each record and rather large.
But the result should be that the pictures for each page (=record) are equal and predefined in the template.

Can this be solved. How ?

Tx,

Kurt

Hi,

Thank you for considering Aspose.

You could probably use DocumentBuilder.InsertImage inside the event handler passing to this method the appropriate width and height of the image. Does it suit you?

Thank,

No, i’m looking for a solution where a user makes up the template in word en the heihgt/width of the images should be determined in the template.

Kurt

Sorry then, there is no an applicable way to do that.