WPCubed Product Support

Merge multiple images

Hi,

how can i insert in mailmerge multiple images for 1 MergeField ?

thanks,

Regards

Samuele

#1 ♥ 0
5.9k Views 2 users read 2 min
wpsupport

Inside the event OnMailMergeGet text the cursor resides INSIDE the merge field.

You can use all methods to insert images or text here.

#2 ♥ 0

i use this code inside OnMailMergeGet to insert each image:

obj:=Wprtf.TextObjects.InsertCopy(TGraphic(lstJpg[nrImg]));
              obj.PositionMode:=wpotChar;
              obj.Unlink;
              obj.Attach(contents.mergePar);
              obj.PositionMode:=wpotChar;

But i don't see the images…..

#3 ✎ ♥ 0
wpsupport

It's really like I wrote, you can simply add text and images like you would usually using code.

procedure TForm.WPRichText1MailMergeGetText(Sender: TObject;
  const inspname: string; Contents: TWPMMInsertTextContents);
begin
   (Sender as TWPCustomRtfEdit).TextObjects.InsertCopy(Image1.Picture.Graphic);
end;

You can insert another image, use InputString to insert some text...

But if you do so, you need to leave Contents unchanged. Also do not use Contents.MergePar or anything else inside Contents.

#4 ♥ 0

I use WpTools v.5 and doesn't work.... this is a feature of new version ?

Inside RTF file generated, i see :

\pard\plain\sl-198\qj\plain\f1\fs18\par
\page\plain\f2\fs22  {\*\wptools\wpomode0\wpoframe0{\bin98 
 TWPObject TPF0    TWPObject WidthTW Ã  HeightTW@'  WriteRTFModewobAutomaticObjTag   ??? }}\par
\page\plain\f2\fs22  \par

If not, can I add an empty second after the first page and insert my images?

REgards

#5 ♥ 0
wpsupport

You are posting in the WPTools 8 section - I had to presume you were using this.

Please use the code published for WPTools 5 to insert images, there are some examples.

You can load an image from file or stream.

#6 ♥ 0
This category is archived. No new posts are possible.