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

MS WORD

    Sponsored Links

    Next

  • 1. trouble with my space bar removing what I have typed
    When I am typing and go to use my space bar, it removes what I have already typed, same with the tab, when I tab to something it removes what I have typed, what is wrong?
  • 2. How do I automactically capitalize after a period?
    Sometimes words after a period are capped and sometimes not. I do medical transcription so have many periods in the body of my typing. I found the "exception" part but it seems to be the "opposite" of what I need to do. I have numbered lists and after typing "1." and then a tab, the first word of my parag. is not capped. Also, sometimes in the body of my typing if a number is in the sentence before, It won't cap the first word of the next sentence. Thanks for any help.
  • 3. Find or replace special charachter
    I am trying to do a find or replace on the charachter created when Shift + Enter is inserted into a document. When you reveal formatting it looks like a bent arrow pointing to the left. Copy and paste into find does not help. Anyone know how to enter this into the find/replace search so it will find this charachter? TIA George
  • 4. Oops, sorry, wrong nsg ( Fax Console remains in memory)
    Oops, I didn't mean to post it here, sorry :-) I meant it to go to the <..windowsxp.newusers> nsg. Paul R Paul R wrote: > I find that after sending a fax with XP's fax console wizard, > <fxssvc.exe> remains in memory and attempts to answer the phone (which I > don't want). I don't have it set up to auto-answer so I'm puzzled as to > why it remains "on" following each fax I send out. Only deleting it from > the Task Manager list of active processes works. > > Is there a way to either (a) prevent it from remaining active following > a fax trasmission or (b) closing it without going thru Task Mgr? (right > clicking on the Systray icon does not offer any option to close it). > -- Paul R ------------------------------- For email reply, please remove 195
  • 5. Custom numbering with chapter number
    In Word 2002, I have equations (made with Word's equation editor) that I need to number. The number must be on the far right side of the line with the equation, must be surrounded by parentheses and must have the form x.y, where x is the chapter number in which the equation appears and y is the number of the equation, which restarts at 1 in each chapter. For example, a = b + c (3.2) Is there a way to make numbers like this that update automatically as more equations are inserted? It seems like fields such as SEQ or LISTNUM would work, but I don't see how to get the chapter number or correct format with them. Thanks. Greg

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
rtf-file?

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

K.reg...
D

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>
[DllImportAttribute("gdiplus.dll")]
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;

try
{
_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
_graphics.ReleaseHdc(_hdc);
}

// 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,
EmfToWmfBitsFlags.EmfToWmfBitsFlagsDefault);

// 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)
{
_rtf.Append(String.F

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

     fr.open()

Next 

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 13 guest