WPCubed Product Support

Image-Scaling in RTF

I have just upgraded from Version 5.09 to Release 17.4. When I save the text as RTF the scale-factor is not saved anymore. All images a scaled to 100%. I'm saving the image with the WriteObjectMode "wobRTF". In 5.09 it worked without problems.

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

Hi,

There was a problem when saving images which had to be solved. It should save the correct size, I cannot reproduce any problem here.

Julian Ziersch

#2 ♥ 0

In 5.09 the scaling worked fine but if I save the same text in 5.17 and open it in word or the mini-demo of WPTools all images a scaled to 100%.

I'm using this code to scale an image:

OrigWidth:=muldiv(wpRichText.SelectedObject.ObjRef.Picture.Graphic.Width,1440,96);
OrigHeight:=muldiv(wpRichText.SelectedObject.ObjRef.Picture.Graphic.Height,1440,96);
wpRichText.SelectedObject.Width:=muldiv(OrigWidth,FmScaleFactor.ScaleFactor,100);
wpRichText.SelectedObject.Height:=muldiv(OrigHeight,FmScaleFactor.ScaleFactor,100);
wpRichText.ReformatAll;
wpRichText.Invalidate;
wpRichText.Update;

FmScaleFactor.ScaleFactor is the scale in percent.

Is there anything wrong with my way to scale the images?

In my program I save a list of texts into a stream. To do so I'm using the SaveToStream-method of TWPRichText and wobStandard as WriteObjectMode. If I load a text out of this stream, the images are scaled correctly. If I use wobRTF when saving to an RTF-file the images are scaled to 100%. If I use wobStandard there, there are no images within the RTf anymore.

#3 ♥ 0
support

Hi,

are this linked or embedded images. For linked images Word cannot use the width and height of the objects, there is no field property for it. WPTools uses the field properties w and h now, but that has been added only a few weeks ago.

Please save the file in WPT and RTF format - I should then see the problem.

Instead of
OrigWidth:=muldiv(wpRichText.SelectedObject.ObjRef.Picture.Graphic.Width,1440,96);

You can use OrigWidth := wpRichText.SelectedObject.ObjRef.ContentsWidth;
(similar with "Height")

Julian Ziersch

#4 ♥ 0

I was on holiday for a few days. I will send the file to the support-email-address.

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