none
Show to show word docuemnt in Browser with images using openxml or any other method. RRS feed

  • Question

  • Hi All,

    I am working on showing word document in browser. After lot of research I have finialize to use open xml which convert word docuemnt to xml and I bind that document to browser. It work fine for text. But if my word docuemnt contains images then I am not able to view it in browser.

    I am able to render images form word docuemnt to some folder. But how will Open Xml automatically set the image path in the tag and display in browser or any other method to programatically bind image path to tag.

    Thanks,

    Pramod

    Saturday, July 30, 2011 4:58 AM

Answers

  • Hi Pramod,

    Please refer to this MSDN article:

    http://msdn.microsoft.com/en-us/library/ff628051.aspx

    which  introduces  the HtmlConverter class which can transform images correctly. See the description:

    This issue is somewhat more difficult because images in WordprocessingML are embedded in the package (the .zip file), but in XHTML, images have their own URL. You must write images to separate files on the disk, or upload them to a server depending on how you want to use the XHTML. The browser that displays the XHTML needs access to those images. The HtmlConverter class enables you to supply an event handler that takes an image as an argument and returns the markup to insert in the XHTML. In that event handler, you can upload or save the image as appropriate, and then return an XHTML IMG element that contains the appropriate URI or URL that points to the image.

    And it contains the detail code snippet about convert to images url. Hope this can help you and just feel free to follow up after you have tried.

    Best Regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Bruce Song Tuesday, August 9, 2011 3:17 AM
    Wednesday, August 3, 2011 6:35 AM