how to insert/embed a gif-file in a rtf-file?


    Sponsored Links


  • 1. Setting tabs for a Word document
    How can I set tabs so that they apply to an entire document? Whenever I set tabs using the tabs dialog box or ruler, I can only get them to apply to a single paragraph. Thanks, A.
  • 2. Using Footers - Page X of Y
    Instead of using { NUMPAGES } for Y, use { = { NUMPAGES } - 2 }. "Joe S" < XXXX@XXXXX.COM > wrote in message news:014a01c353d4$3b270150$ XXXX@XXXXX.COM ... > I have a document, the first page of which is the title > page and the second, the instructions. These two pages > are not and should not, numbered. Page 1 actually is the > 3rd page of the document. Because of this, the footer on > the final page will show Page Y-2 of Page Y. > > Is there some way to remedy this without the obvious, > viz. beginning the numbering on the third page, with a > starting number of 3, rather than 1? This is Page 1 and > should be reflected this way. > > Many thanks
  • 3. E-mail merge with embedded formatting
    Greetings.......... Does anyone know of a way to merge data from an Excel spreadsheet into a Word form letter shell and then into an e-mail that is formatted? 'Merge to...E-mail' gives me the choice to either send a fully formatted file as an attachment or to send an e-mail in plain text, embedded format. Is there a way, using Outlook, macros, Word or some combination thereof, to send an e-mail that's formatted to look as it did as a Word file? Furthermore, is there a way that will work on the major e-mail platforms and not run afoul of their security settings? Any help would be very much appreciated..............
  • 4. SUM Functions in a table..
    I have come across a bad bug, perhaps, in Word XP. I had an 8 column, 4 row table. The last row in each column gave the total. I input a field to do a SUM(ABOVE).... so add up everything above it in that column, right??? Well, it didn't work. It added everything in the column above it, except it stopped at the first empty cell and didn't bother to include the figure above that one either. I understand it's no spreadsheet. I just did it for my small company... we print our own letterheads in our office, and this was a price quotation that I had put ontop of my letterhead template. Just one cell was left empty because that line didn't need a price in it. Any ideas how to overcome this?
  • 5. Please help me out, the inserted hyperlink is not working at all !!
    Hello to all, I am currently with on an Employee Newsletter with Word 2000 with SP2 and planning to send to email recipient. If the recipient receive the Newsletter via email and want to print out the Newsletter, all they need to do is to simply click a link and download the Word document from the common network for everyone within the organization called "W Drive" The problem now I came across is that when I want to insert a link for the recipient to download the Word file for Printing, the link is not working. When I manually type in the following links, I have tried W:\JulyLetter2003.doc or \\pocofiler\data\JulyLetter2003.doc and then save the document and then email it to myself and click on the link, nothing happens. Then I use my Word manually open that Newsletter and go to that hyperlink and then Edit link and all I can find the link is JulyLetter2003.doc but not W:\JulyLetter2003.doc or \\pocofiler\data\JulyLetter2003.doc and may I know what should I do to ensure my Word hyperlink point to the correct path ?? Please kindly advise ASAP.

how to insert/embed a gif-file in a rtf-file?

Postby dpe2001go » Sat, 03 Apr 2004 22:05:10 GMT

Hi there,

We have a program that generates a rtf-file (some 1.500 pages...) and
all of them should be signed. Problem: I'm not able to link/embed
(using insert | field) the signature-file (let's say: sign.gif), the
program works with its own templates (rtf), and I've been searching
and trying some things but after inserting, the filesize increases up
to 1,5 mb, and that's something that piece of software obviously
doesn't like. (the original 'template'/rtf is about 39 kb)

Is there a way to include/embed/... that boring sign.gif into the

All tips are welcome, as long as I don't have to copy-paste for a
thousand times!


RE: how to insert/embed a gif-file in a rtf-file?

Postby U2FjaGlu » Tue, 22 Jun 2004 10:46:02 GMT

ry following C# code to embed the image in an rtf doc, tell me if it works.

/// <summary>
/// Allows the x and y coordinates of metafile to be adjusted independently
/// </summary>
private const int MM_ANISOTROPIC = 8;

/// <summary>
/// Use the EmfToWmfBits function in the GDI+ specification to convert a
/// Enhanced Metafile to a Windows Metafile
/// </summary>
/// <param name="_hEmf">
/// A handle to the Enhanced Metafile to be converted
/// </param>
/// <param name="_bufferSize">
/// The size of the buffer used to store the Windows Metafile bits returned
/// </param>
/// <param name="_buffer">
/// An array of bytes used to hold the Windows Metafile bits returned
/// </param>
/// <param name="_mappingMode">
/// The mapping mode of the image. This control uses MM_ANISOTROPIC.
/// </param>
/// <param name="_flags">
/// Flags used to specify the format of the Windows Metafile returned
/// </param>
private static extern uint GdipEmfToWmfBits (IntPtr _hEmf, uint _bufferSize,
byte[] _buffer, int _mappingMode, EmfToWmfBitsFlags _flags);

/// <summary>
/// Wraps the image in an Enhanced Metafile by drawing the image onto the
/// graphics context, then converts the Enhanced Metafile to a Windows
/// Metafile, and finally appends the bits of the Windows Metafile in HEX
/// to a string and returns the string.
/// </summary>
/// <param name="_image"></param>
/// <returns>
/// A string containing the bits of a Windows Metafile in HEX
/// </returns>
private string GetRtfImage(Image _image)

StringBuilder _rtf = null;

// Used to store the enhanced metafile
MemoryStream _stream = null;

// Used to create the metafile and draw the image
Graphics _graphics = null;

// The enhanced metafile
Metafile _metaFile = null;

// Handle to the device context used to create the metafile
IntPtr _hdc;

_rtf = new StringBuilder();
_stream = new MemoryStream();

// Get a graphics context from the RichTextBox
using(_graphics = this.CreateGraphics())

// Get the device context from the graphics context
_hdc = _graphics.GetHdc();

// Create a new Enhanced Metafile from the device context
_metaFile = new Metafile(_stream, _hdc);

// Release the device context

// Get a graphics context from the Enhanced Metafile
using(_graphics = Graphics.FromImage(_metaFile))

// Draw the image on the Enhanced Metafile
_graphics.DrawImage(_image, new Rectangle(0, 0, _image.Width, _image.Height));


// Get the handle of the Enhanced Metafile
IntPtr _hEmf = _metaFile.GetHenhmetafile();

// A call to EmfToWmfBits with a null buffer return the size of the
// buffer need to store the WMF bits. Use this to get the buffer
// size.
uint _bufferSize = GdipEmfToWmfBits(_hEmf, 0, null, MM_ANISOTROPIC,

// Create an array to hold the bits
byte[] _buffer = new byte[_bufferSize];

// A call to EmfToWmfBits with a valid buffer copies the bits into the
// buffer an returns the number of bits in the WMF.
uint _convertedSize = GdipEmfToWmfBits(_hEmf, _bufferSize, _buffer, MM_ANISOTROPIC, EmfToWmfBitsFlags.EmfToWmfBitsFlagsDefault);

// Append the bits to the RTF string
for(int i = 0; i < _buffer.Length; ++i)

Similar Threads:

1.embedded file objects in rtf files

I am trying to save each embedded  file object in a rtf file.  I am able to 
get to the file object  but dont know what else to do since the OLEFormat 
doesn't have a save as method.  How can I go by on saving each file object to 
a directory? The majority of my embedded file objects are pdf file.  Here' s 
my code:

Dim oWord As Word.Application 

Dim oDoc As Word.Document

Dim fl As Word.InlineShape

Dim fr As Word.OLEFormat

oWord = New Word.Application

oWord.Visible = True

oWord.WindowState = WdWindowState.wdWindowStateMinimize

oDoc = oWord.Documents.Open(FileName)

For i = 1 To oDoc.InlineShapes.Count

     fl = oDoc.InlineShapes.Item(i)

     fr = fl.OLEFormat


End If

I use the open method just to make sure I reference the file object.

Please help!!!

Juan E. Garcia

2.RTF and GIF files

When haveing an rtf referencing a gif file (import command) under Windows 2000 / Word 2000 / Sv pack 3, Word doesn't display the gif graphics (and event not print)

When haveing the same under Win2000 / Word 2000 - the graphics are visible in Page Preview and on printouts

Thanks and kind regards
Stephan Gloo
Gloor Informatik

3.Insert RTF File... Disable "Conversion File" window

4.Embedded .jpeg and .gif files

I have a document which required the files to be embedded in the document as 
icons, in Word 2000. I understand that insert-->object is a bad way to go, so 
is there any other way to embed (no I can't link the files, they must be in 
the document), jpegs and gif files into a word 2000 document without their 
size increasing by a factor of 10+? I can embed Word and Pdf files without 
much of an increase in size. Also it seems when I try to embed .gif and .jpeg 
files, word sets the icon as the Word icon, not the jpeg/gif icon.
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

5.Embedded jpeg and Gif files increasing in size

Recently I tried to embed a .gif and .jpeg into a word document. I need to 
have the files embedded and showing as an icon. The only way I know how to 
embed a picture as an icon is by inserting it as an object. But when I do, 
the file size increases by a factor of 10!!! so a 500k jpeg on a blank Word 
2000 document makes the Word document size 5 megs. I tried this with a PDF, 
and had no such problems. How can I avoid increasing the Word document size 
by 10x, but still keep embedded pictures that look like icons?

J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

6. Smallest RTF file which can import or embed an image

7. MS Word 2000 and inserting .GIF files generated from MS Project 98

8. Can't insert GIF image with "Link to File"

Return to MS WORD


Who is online

Users browsing this forum: No registered users and 20 guest