Metafile issue
Posted: Thu Apr 05, 2012 11:38 am
Hello Sergey,
I have an issue when adding metafiles to an RVF document and then saving them to RTF. When adding metafiles, I scale them to the size of the page by adjusting TMetafile.MMHeight and MMWidth. I use TRichView.DocParameters.PageWidth and PageHeight to get the available width and height of the document. The resulting code looks more or less like the following:
So the resulting MMWidth or MMHeight of the metafile should be equal to width or height of the document (actually margins are taken into account as well, but I've removed that code for simplicity). However, when I export it to RTF, the picture doesn't have the desired size. On my PC it looks much smaller than the page width. After some experiments I've found that it looks as I want when I set MMWidth to the value of about 35000, while the page width is 297 mm (A4 landscape). The biggest problem, however, is the fact that on the customer's PC the resulting picture is bigger than the page (not smaller as in my case), so I can't simply use that empirical value. It makes me think that there is some additional scaling somewhere. Do you, may be, know what's going on?
BTW, I don't see the RVF document itself, I only use it as an intermediate storage when exporting to RTF.
Thanks in advance.
I have an issue when adding metafiles to an RVF document and then saving them to RTF. When adding metafiles, I scale them to the size of the page by adjusting TMetafile.MMHeight and MMWidth. I use TRichView.DocParameters.PageWidth and PageHeight to get the available width and height of the document. The resulting code looks more or less like the following:
Code: Select all
mw:=FRVHelper.RichView.DocParameters.PageWidth*100;
mh:=FRVHelper.RichView.DocParameters.PageHeight*100;
if (Metafile.MMHeight < mh) or (Metafile.MMWidth < mw) then
begin
r:=Round(mh/Metafile.MMHeight*100);
If Metafile.MMWidth*(r/100)>mw Then
r:=Round(mw/Metafile.MMWidth*100);
end
else
r:=100;
Metafile.MMWidth:=Trunc(Metafile.MMWidth * r / 100);
Metafile.MMHeight:=Trunc(Metafile.MMHeight * r / 100);
BTW, I don't see the RVF document itself, I only use it as an intermediate storage when exporting to RTF.
Thanks in advance.