InsertHTML does not default to the font in the word document

I am using an ASPOSE Document Builder to insert some HTML at a bookmark in an existing document. The book mark (in fact the entire document) is in a different font than the default word font…



AsposeDB.InsertHtml(temp & “[p]some text[/p]”)



With our prior version of ASPOSE when we would insert this HTML into the document the resulting paragraph in the word document would match the Font surrounding the bookmark.



In this latest version of ASPOSE it does not match the font, instead it looks like it is defaulting to Times New Roman 12 point.



We are on File Version 14.2.1.0 / Product Version 2014.03.20 according to the Aspose.Words.dll



This is critical for our application because we merge user entered content into Word documents to create form letters. The change in font is wrong.



Also, we are inserting .doc files not .docx files.

Hi Chris,

Thanks for your inquiry. In your case, I suggest you please upgrade to the latest version of Aspose.Words for .NET 14.6.0.

Please note that the content inserted by DocumentBuilder.insertHtml method does not inherit formatting specified in DocumentBuilder options. Whole formatting is taken from HTML snippet. If you insert HTML with no formatting specified, then default formatting is used for inserted content.

Please use
overloaded DocumentBuilder.InsertHtml Method (String, Boolean) method if you want to use the formatting of inserted text based on
DocumentBuilder formatting.

When useBuilderFormatting is false,
DocumentBuilder formating is ignored and formatting of inserted text is
based on default HTML formatting. As a result, the text looks as it is
rendered in browsers.

When useBuilderFormatting is true, formatting of inserted text is based on DocumentBuilder formatting, and the text looks as if it were inserted with Write.


If you still face problem, please share following detail for investigation purposes.


  • Please attach your input Word document.
  • Please

    create a standalone/runnable simple application (for example a Console
    Application Project
    ) that demonstrates the code (Aspose.Words code) you used to generate
    your output document

  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated
    like.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.