none
how to reduce RTF file size that contains images

    Question

  • hello experts,

    I am working with an office add-in in C# in VS2008 and need to save a word document in RTF format on the hard drive.

    This document in so many cases contains images that are mostly pasted from the clip-board (taking screen shot using Print Screen button). When I save the document in RTF format the size of the file becomes extremely high. But when the document is saved in .doc format the size becomes surprisingly low.

    The problem here I think is the size of the images pasted from the clipboard that most probably copied in bmp format. I think I need to compress the images or the whole document within my add-in before I save the file into the drive.

    Can anyone please help me through this process to compress/reduce the size of the file programmatically before saving?

    Thanks in advance...

    -Jahedur Rahman

    Friday, June 11, 2010 4:27 AM

Answers

  • Hello Jahedur,

    For this question, you could refer to this KB article: http://support.microsoft.com/kb/224663. It indicates that this issue is by design in Microsoft Word. If an EMF, a PNG, a GIF, or a JPEG graphic is inserted into a Word document, when the document is saved, two copies of the graphic are saved in the document. Graphics are saved in the applicable EMF, PNG, GIF, or JPEG format and are also converted to WMF (Windows Metafile) format. It also introduces a workaround by add a string value to the registry.

    Hope this helps you,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Bessie Zhao Thursday, June 17, 2010 7:52 AM
    Tuesday, June 15, 2010 7:56 AM
  • Sure Bessie...

    I found that KB article. You can close this thread.

    Thanks...

    -Jahedur Rahman

    • Marked as answer by Bessie Zhao Thursday, June 17, 2010 7:51 AM
    Wednesday, June 16, 2010 9:37 AM

All replies

  • Hi Jahedur

    Even though your "container application" is an add-in, the actual problem you're confronting is Word- and file format-oriented.

    You'll find more expertise at this level in the Word Developer forum, which is why I'm going to move your message there. But in order to help you, it's necessary to know which VERSION of Word you're targeting.

    File compression possibilities vary according to version of Word, so this information is very important. In any case, the possibilities available through the object model are rather limited. It may be that you'll need an application (dll called from your add-in, perhaps) to manipulate the image information stored in the RTF file, directly, in order to reduce file size. That kind of question would best be asked in a forum that deals with the .NET tools for handling graphics images. I don't know which forum that might be; you can try asking in the "Where is the Forum for..." forum if you don't know, either :-)


    Cindy Meister, VSTO/Word MVP
    Friday, June 11, 2010 6:37 AM
    Moderator
  • Thanks Cindy for your reply and moving the thread to the right forum...

    btw, I am using Word 2007...

    -Jahedur Rahman

    Friday, June 11, 2010 7:56 AM
  • Hello Jahedur,

    For this question, you could refer to this KB article: http://support.microsoft.com/kb/224663. It indicates that this issue is by design in Microsoft Word. If an EMF, a PNG, a GIF, or a JPEG graphic is inserted into a Word document, when the document is saved, two copies of the graphic are saved in the document. Graphics are saved in the applicable EMF, PNG, GIF, or JPEG format and are also converted to WMF (Windows Metafile) format. It also introduces a workaround by add a string value to the registry.

    Hope this helps you,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Bessie Zhao Thursday, June 17, 2010 7:52 AM
    Tuesday, June 15, 2010 7:56 AM
  • Hi Bessie

    Jahedur started another message thread, that has been moved to the Windows Forms forum this morning. He'd already found this article, and the information in it lead to another problem. When the EMF data is removed, the RTF control doesn't recognize the picture.


    Cindy Meister, VSTO/Word MVP
    Tuesday, June 15, 2010 8:10 AM
    Moderator
  • Cindy, sorry, I missed this thread in Windows Forms forum. Thanks for your kindly reminder. I will look into another thread in Windows Forms forum.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, June 15, 2010 9:51 AM
  • Thanks a lot Cindy and Bessie. Hoping to get a solution... Jahedur Rahman
    Tuesday, June 15, 2010 5:41 PM
  • Hello again Jahedur,

    For this question, by looking at another thread, it seems that you have also found this KB article to reduce the file size. So I will close this thread.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, June 16, 2010 3:03 AM
  • Sure Bessie...

    I found that KB article. You can close this thread.

    Thanks...

    -Jahedur Rahman

    • Marked as answer by Bessie Zhao Thursday, June 17, 2010 7:51 AM
    Wednesday, June 16, 2010 9:37 AM
  • We have had this problem and our line of business application tests and fixes the registry.  What we have found is that it has reverted to large file size  some time this year.  Have started a thread on it, but it isn't getting any interest: http://social.technet.microsoft.com/Forums/en-US/officeitpro/thread/bd1a5b7b-bfb9-4e86-9877-a99a8fa76029

    Regards, JAC


    TIA - Jason
    Tuesday, July 19, 2011 4:37 PM