WPCubed Product Support

Mailmerge - insert graphic

I just tried to insert a TGraphic (TMetafile image) into my Editor, but didn't get it working

My first try was to find the Mailmergefields

mmList      := TWPTextObjList.Create;        RichText.FieldGetList(mmList, TRUE);        for i:=0 to mmList.Count-1 do begin            mmItem  := mmList[i];CopyChartToFile('d:\test.png');// Here also tried per stream or as EMF ....                 wpObj   := TWPOImage.Create(RichText.Memo.RTFData);(* Also tried                wpobj := TWPOImage.Create(tempDokument.RichText);                wpobj.Graphic := tempGraphics;//Image1.Picture.Graphic;                wpobj.WidthTW := wpobj.ContentsWidth;                wpobj.HeightTW:= wpobj.ContentsHeight;*)                wpObj.LoadFromFile('d:\test.png');                mmItem.ObjType  := wpobjImage;                mmItem.objRef   := wpObj;(* Also triedmmItem.LoadObjFromFile('d:\test.png');*)            end;        end;        mmList.Free;

-> All theses treis didn't do anything ... nothing appears on the resulting document

And i treid it also in the mailmerge event
Here also tried as PNG or as EMF, per file and per TStream

procedure MailMergeGetText(Sender: TObject; const inspname: string; Contents: TWPMMInsertTextContents);        

wpObj   := TWPOImage.CreateImage(Contents.DataCollection, tempGraphics);
            // wpobj.LoadFromFile()
        Contents.obj := wpobj;

// and here also tried
CopyChartToClipboard;
        WPRichText.PasteFromClipboard();

        WPRichText.TextCursor.SelectToHere(Contents.StartInspObject);

After this the whole document is duplicated -> all text are twice and the image of the charts is twice, but the first appearance of the image only a playeholder is seen (no image only the border)

What i am doing wrong?

#1 ♥ 0
4.1k Views 1 users read 2 min

Just found the problem

It was nothing with generating the Text, it was the viewer,
The viewer loaded the WPT Text, and than the GNU-Get Text unit tries to translate the text per RTTI and after that the text was wrong!

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