none
How to serializing ActiveX control image in JPEG format RRS feed

  • Question

  • Hi guys,

    I have developed an ActiveX control which is used to open and JPEG image.

    The problem here is when i serialize my activeX control with word the word document size is coming out to be too large.

    For example it is taking around 14 MB to store one JPEG image along with my activeX control.

    When I debugged it I found that the word is actually decompressing the image to .bmp and than try to compress it and finally save the image in .wmf format. Which is compared to JPEG has a huge size and causing the issue.

    I want to know if there is a way in which i can serialize the image in JPEG format like word do the serialization of its own picture viewer.

    Thanks in advance.

    Regards,

    Guru.......



    Friday, July 5, 2013 12:11 PM

Answers

  • Word will always save a graphic representation of an ActiveX control in the document. If, for some reason, the ActiveX control can't hook up to its APIs, Word will simply display the graphic. I don't think there's any way to tell Word to not to that.

    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 12, 2013 11:11 AM
    Moderator

All replies

  • Hello,

    Thanks for your participation in this forum. I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and have a nice day!


    Damon Zheng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 9, 2013 1:07 PM
    Moderator
  • Thanks for the information Damon Zheng

    I am eagerly waiting for the solution.

    Regards, 

    Guru.......

    Wednesday, July 10, 2013 3:09 AM
  • Hi,

    I have found one more thing.

    As I mentioned earlier the word has saved the image as .wmf file.

    So I open the word document in XML file format and delete that .wmf file from media folder to reduced the size of the document. 

    Than again I reopen the document thinking it wont open but to my surprise it opens flawlessly the reason for that is my activeX control is derived from the interface IPersistStreamInitImpl so i am serializing all the stuff during save including the JPEG image I have loaded, and during de-serializing also i am loading the image form the stream where i had saved it.

    Which means the word is saving that .wmf file for something else.

    kindly help me out in finding the reason why the word is saving that extra file, Is there some parameter I need to set to prevent the word for saving  the image of my activeX control separately.

    Best Regards,

    Guru Ahtasham.......

    Friday, July 12, 2013 4:13 AM
  • Word will always save a graphic representation of an ActiveX control in the document. If, for some reason, the ActiveX control can't hook up to its APIs, Word will simply display the graphic. I don't think there's any way to tell Word to not to that.

    Cindy Meister, VSTO/Word MVP, my blog

    Friday, July 12, 2013 11:11 AM
    Moderator
  • Thanks for the information Cindy.

    But is there a way we can make word to save that graphic representation in JPEG format instead of .wmf file.

    As word save the image of its own picture viewer as JPEG cant we do the same for activeX controls.

    Regards,

    Guru....

    Monday, July 15, 2013 3:34 AM
  • If there is a way, it's not part of the Object model. As far as I know, how ActiveX handles this is something completely internal to Word. Unless there's an interface in the ActiveX specification that supports this, but about that I have no idea.

    Cindy Meister, VSTO/Word MVP, my blog

    Monday, July 15, 2013 9:35 AM
    Moderator
  • Hi,

    There isn't a way to save an ActiveX control as a .JPEG format in word.

    If you were referring 'Picture content control' as 'picture viewer', it isn't an ActiveX control.

    Regards

    Pradip

    Saturday, August 17, 2013 4:08 AM