Creating RTF-File with WMF Graphics included

Creating RTF-File with WMF Graphics included

Post by Markus Koc » Sat, 25 Mar 2000 04:00:00



Hallo,

we have a problem when creating RTF-Files with WMF-Graphics included.
First we create a TMetafile with the following parameters:
-Enhanced=false;
-width=PixWidth;
-height=PixHeight;
Then we create a TMetafileCanvas from the above TMetafile to paint on.
When painting is finished, we insert in the RTF-File the following tags:
fprintf( RTFFile,
"{\\pict\\wmetafile1\n""\\picw%ld\n""\\pich%ld\n""\\picwgoal%ld\n""\\pichgoa
l%ld\n"
                            , widthPix, heightPix, widthPix  * 20, heightPix
* 20  // TWIPS = 1/20 Pixel );
After inserting these tags we write the Metafile to the RTF-File by
converting every Byte
we get of  the TMetafile->SaveToStream Function to hexvalue. After that we
add an "}".
When we open the RTF-File with MS-WORD there is all the Text, but no
graphic. Sorry,
there is a Box at the place where the graphic shoud appear, but no image.
The similar same procedure with a TBitmap (other tags) works fine.

Do someone has an idea whats wrong ?

Thanks for help!

Markus
Kretz Software GmbH

Sorry for my english!

 
 
 

1. * * * URGENT Include an EnhancedMetaFile in a RTF File * * *

Hi *.*

I'm trying to put an EMF in an RTF
I can store the emf on disk using the CreateEnhMetaFile API
I can create a memory based EMF with the CreateEnhMetafile API and export it
as an Emf using
    Clipboard.SetData hEmf, vbcfMetafile
I can insert the emf into an rtf string, insert the string in the clipboard
and paste it into Word 2000 using
    Clipboard.SetText strRTF, vbcfRTF
Result:
    The PageLayout view shows it like I want it.
    The PrintPreview shows it like I want it too.
    When I try to print it, using word, only a small part of the emf is
zoomed in the expected image rectangle.

What am I doing wrong?
I want the printed document to look like the preview...

Thanks.



2. Artist filters

3. Trees in PoV and include files producing include files

4. Artist's site

5. wmf metafile & RTF tags

6. Polygonal mesh CSG

7. PCX to either WMF or RTF conversion

8. ? about Fur

9. RTF to WMF

10. rtf to bmp or wmf or dib

11. WMF in RTF

12. wmf metafile & rtf tags

13. wmf and rtf