This project has moved and is read-only. For the latest updates, please go here.

Problem with Image in docx file.

Jan 19, 2015 at 4:01 PM
Hey, i just wanna use this library in my project but i have issue with images.

When im converting html around new MainDocument part in brand-new document everything seeem to be ok, but in my project i have template.

In this case i wanna insert converted HTML to my template using OpenXML. After open, i have no image, only border with alert "This image cannot currently be displayed".

Whats going on?
Jan 19, 2015 at 5:09 PM

When the parser encounters images, it creates relations to "ImagePart". This is how works OpenXml.
I recommend you to use this library with the final MainDocumentPart that you targets, not working with a "temp" DocumentPart.
using (WordprocessingDocument package = WordprocessingDocument.Open(template, true)) {
    HtmlConverter converter = new HtmlConverter(package.MainDocumentPart);