We have a requirement to generate MS-Word file from content stored into different database tables. Some of these content are HTML snippets (well formed HTML). I have managed to create the required Word document by using AlternativeFormatInputPart.
Now the problem I'm facing is styling some of these text segments. In particular, one of the HTML fragments contain multilevel list elements - they are being rendered as such in the generated document. But I need to style them differently - for example, change w:ind left and hanging values, w:lvlText values etc.
I followed the example in NumberingRestart.java code to create a new w:Numbering element with some of my formatting requirement. But the generated document still renders in the default way.
I saved the generated document in Word 2003 XML format and when I look at the content, I noticed that there were two w:listDef elements. The NumberingDefinitionPart I created in my code has generated <w:listDef w:listDefId="1"> element. However, there is another <w:listDef w:listDefId="0"> element just prior to this one - and the list is being rendered using this one.
If I manually remove the <w:listDef w:listDefId="0"></w:listDef> element and rename <w:listDef w:listDefId="1"> to <w:listDef w:listDefId="0">, I can see that my intended formatting is working.
Can you please suggest a way to work around this issue?
I'm attaching the sample code illustrating the problem - I'm using docx4j 2.7.0.