Automatic number in titles with wrong font-size


I have a problem with my automatic numbers in titles.

I have a simple html that I want to convert in word. I use a template that I update with the following java code (the html and the code are at the end of this message)
My problem is that, when I open the final word, the number in front of the title doesn’t have the same size as the title.
But, when I click at the end of the title and press “enter”, the size of the number is updated (which means that the word style is working).
I joined my template, and the final result in the attached zip file. It’s an easy docx template, where title1 has font-size 16px and automatic juridic numbers (it means that title2 have the numbers 1.1 and title3 have numbers 1.1.1, etc…)

In the zip file with the template and the final result

Document doc = new Document(new ClassPathResource(wordTemplate).getInputStream());
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertHtml(html, true);
doc.updateTableLayout();, SaveFormat.DOCX); (26.6 KB)


Thanks for your inquiry. Please note that Aspose.Words mimics the behavior of MS Word. If you insert the HTML document into “word-template.docx” using MS Word (Insert->Object->Text from File), you will get the same output.

We have tested the scenario using latest version of Aspose.Words 18.9 and have noticed that the list number is not imported into document. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-17423. You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.


Thanks for your patience. This issue appears when the second parameter of DocumentBuilder.InsertHtml method is false. The second parameter of this method is ture in your code. So, there is no issue with the output document. We have closed this issue (WORDSNET-17423) as ‘Not a Bug’.