DocumentBuilder.insertHtml method

Hello,

I want to insert into a DOCX an HTML using a target user style. I have used the code below but it’s not working, the inserted paragraphs have the ‘Normal’ style.

builder.moveToDocumentEnd();
builder.getParagraphFormat().setStyle(myStyle);
builder.insertHtml(myHtml);

Thanks in advance for your answer.

Regards,

Benoît Hénaud

Hello
Thanks for your request. The content inserted by Insert HTML does not inherit formatting specified in DocumentBuilder options. Whole formatting is taken from HTML snippet.
But you can try using the workaround provided by Adam in this thread:
https://forum.aspose.com/t/53489
Hope this helps.
Best regards,

Andrey - is there any way to suppress the formatting in the HTML? We are inserting HTML that contains tags to change font size and color, but when we output this document, we want the font standardized to be the same throughout the merged document. Will this project do that?
Thanks,
Todd Davis
UniMed Direct

Hello
Thank you for additional information. Have you tried using the approach suggested by Adam? I think it is exactly what you are looking for.
Best regards,