Birder Omitted from Embedded HTML Image


The attached HTML file (“MissingBorder.html”) has an embedded PNG image and the <IMG> node uses the following border style attribute:
style='border:1px solid #ff0000 !important;

When the HTML file is rendered in any major browser, thin red border is shown. However, when inserted into a document via the DocumentBuilder.insertHtml API - the border disappears.

The following code demonstrates how to reproduce this behavior.
If you run the code (after adjusting the file path to the attached HTML file) - you should see that the Document generated will show the image but not the red border (that is shown in the browser). (6.9 KB)

  final String htmlSrc = "[file_path]\MissingBorder.html";
  try {

   // create new blank document
   Document wdDoc = new Document();
   DocumentBuilder builder = new DocumentBuilder(wdDoc);

   // load the html
   final String html = new String(Files.readAllBytes(Paths.get(htmlSrc)));

   // add the paragraph to the document
   Paragraph para = builder.insertParagraph();
   // insert the HTML into the doc - keep HTML formatting intact
   builder.insertHtml(html, false);".html", ".docx"));
   System.out.println("Saved Document: n\t" + htmlSrc.replace(".html", ".docx"));

  } catch (Exception ex) {
      System.out.println("Unexpected EXCEPTION: \n\t" + ex.getClass().getName() + " - " +




Thanks for your inquiry. We have tested the scenario with your shared HTML file and noticed the reported issue. We have logged a ticket WORDSNET-15881 in our issue tracking system for further investigation and rectification. We will notify you as soon as it is resolved.

We are sorry for the inconvenience.