Font formatting is incorrect after inserting HTML into document using Java

Hi, I recently upgrade my Aspose.Words.Java from 4.0.3 to the latest 11.6.0 on my html2doc project, every thing works fine but the font class seems not working, for example, I am using

documentBuilder.getFont.setBold(true); documentBuilder.insertHTML(“


But this is not give me the bold font any more, do you have any idea about the reason?


Hi Matthew,

Thanks for your query. The insertHtml method inserts HTML into a document using DocumentBuilder . You can use insertHtml to insert an HTML fragment or whole HTML document. Please use insertHtml method as shown below:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

builder.insertHtml("**hello html**"); + "AsposeOut.docx");