WPCubed Product Support

Size image insert

Hi
I am trying to insert images into letter template with

var txtobj: TWPTextObj;
begin
if OpenPictureDialog2.Execute and (WPRichText1.ActiveParagraph <> nil) then
begin
WPRichText1.SetFocus;
txtobj := WPRichText1.Memo.RTFData.TextObjects.Insert(
WPLoadObjectFromFile(
WPRichText1.Memo.RTFData,
OpenPictureDialog2.FileName), 1440, 1440);
// Code to change the graphic, for example change width and height ot the
'PositionMode'
if txtobj <> nil then
begin
end;
WPRichText1.Refresh;
end;
end;

What I need to know is how can I change the 1440,1440 into the correct size for the picture. I can see the OpenPictureDialoge displays this but I can not find how to do this?

Can you help?

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

Hi,

If you assign
WPLoadObjectFromFile(WPRichText1.Memo.RTFData, OpenPictureDialog2.FileName)

to variable "obj" of type TWPObject you can retrieve its natural width and height using

obj.ContentsWidth and obj.ContentsHeight.

Julian

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