WPCubed Product Support

OnMailMergeGetText Image PositionMode

There is the possibility to specify the position(relative page, relative paragraph, relative text, ecc) of a image at run merge?

MailMergeGetText(Sender: TObject;
  const inspname: String; Contents: TWPMMInsertTextContents);
 var textobject : TWPOIMAGE;
 begin

        if contents.CurrentObject= nil then
        begin
            create:=true;
//            textobject :=TWPOImage.create(wprtf.Memo.RTFData);
            textobject :=TWPOImage.create(wprtf);
           end
        else
           textobject:=TWPOImage(contents.CurrentObject);

         textobject.Graphic:=jp;

 if create then
          begin
                  textobject.WidthTW:=WPCentimeterToTwips(varBol.width);
                textobject.HeightTW:=WPCentimeterToTwips(varBol.height);
              contents.Obj:=textobject;

          end
          else
          begin
              Contents.CurrentObject.WidthTW:=WPCentimeterToTwips(varBol.width);
              Contents.CurrentObject.HeightTW:=WPCentimeterToTwips(varBol.height);
          end;
end

Thanks.

Regards

#1 ♥ 0
6.5k Views 2 users read 2 min
support

Hi,

You will have to add a new and positioned image inside the MailMerge event and leave "Contents" unchanged. You can do most operations with the TWPRichText inside the event, since the contents of the field are selected when OnMailMergeGetText is beeing called.

Julian

#2 ♥ 0

Hi,

i used in event mailmerge this code :

Imageobject :=TWPOImage.create(wprtf);                  textObject:=TWPTextObj.Create;                  textObject.ObjRef:=Imageobject;                  textObject._SetObjType(wpobjImage);                  textObject.PositionMode:=wpotPage;                  textObject.Wrap:=wpwrBoth;                  contents.Obj:=textObject;

but so i don't see the image.... if i replace

contents.Obj:=textObject;

with

contents.Obj:=imageObject;

i see the image but the positionMode doesn't work.
Any suggestions ?

REgards

#3 ♥ 0
support

The textobject belogs to a paragraph can may not be created like this.

as I said:

You will have to add a new and positioned image inside the MailMerge event and leave "Contents" unchanged. You can do most operations with the TWPRichText inside the event, since the contents of the field are selected when OnMailMergeGetText is beeing called.

While the program is inside the event handler you can insert an image into the text using the usual (cursor) methods and NOT use Contents.

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