Page 1 of 1

Metafiles Problem

Posted: Thu Sep 02, 2010 3:14 pm
by MichaelV
Hallo,

i have problems with metafiles here (emf).
I made a dokument with an embedded image (emf).
(because of much better printing)

TRichview shows the dokument fine, but when i save it to rtf,
word displays only a little one.
If i embed a bitmap (same source) it works.

Is this a bug or is there a trick?

Michael


[/url]

Posted: Thu Sep 02, 2010 3:27 pm
by Sergey Tkachenko
Please send me RVF document with this metafile to email.

Posted: Thu Sep 02, 2010 5:39 pm
by MichaelV
sended!

Posted: Fri Sep 03, 2010 5:44 pm
by Sergey Tkachenko
I am afraid the only way to fix it is to modify your metafile. Its size is too huge.

Explanation.

When you load it in TMetafile, it has size 9999x5324 pixels. TRichView always uses this size (Graphic.Width and Graphic.Height properties) as 100% size of a picture. In the document, this picture is scaled to 600x319 pixels (i.e. 6% of its original size).

MS Word calculates picture size differently: it takes picture resolution to the account. I.e., by default, it uses not 9999x5324 as the original picture size, but (9999*picture resolution ratio)x(5324*picture resolution ratio). To prevent different calculations, TRichView uses special keywords to define the original picture size: picwgoal and pichgoal. They contain values in twips: \picwgoal149985\pichgoal79860 for your picture.
So TRichView define the original picture size and specify that the picture is scaled to 6%.

Normally, it works. But not for your metafile. It is because the numbers are too large and simply ignored by MS Word.

So the only solution is to make this metafile smaller.

Posted: Sat Sep 04, 2010 11:39 am
by MichaelV
ok, thank you,

it is no problem, the metafiles are generated by my program, i can easy change them. i insert metafiles, because of little size an much petter printing quality (this are generated drawings) The problem is, there can be small numbers from the dimensions.

please explain, how is the maximal pixel size in each direction, that you can handle?

Michael

Posted: Sat Sep 04, 2010 11:47 am
by Sergey Tkachenko
I believe you need to decrease metafile size at least by 10.
I am not sure which maximal size of picwgoal and pichgoal is understood by MS Word.

Posted: Mon Sep 06, 2010 12:57 pm
by MichaelV
it works,
i have now 2000 units in each direction, and the wmf is good printable yet.
the export to rtf is ok :D