plutext / docx4j-ImportXHTML

Converts XHTML to OpenXML WordML (docx) using docx4j
136 stars 125 forks source link

Multilevel numbered list imported with reset counter inside list #57

Open Alister71 opened 5 years ago

Alister71 commented 5 years ago

When importing multilevel numbered list, numbering of second inner level is reset starting second parent item. Actually, new concreteList with override level is assigned to inner list starting second occurence of inner <ol></ol> container. To fix this situation it is enough to change initialization of inner class ListItemContentState of ListHelper.java ListItemContentState.isFirstItem should be initialized with false value, not true. https://github.com/plutext/docx4j-ImportXHTML/blob/master/src/main/java/org/docx4j/convert/in/xhtml/ListHelper.java#L175 Instead of protected boolean isFirstItem = true; should be protected boolean isFirstItem = false; The example of multilevel numbered list treatment is at stackoverflow: https://stackoverflow.com/questions/55144169/when-importing-multilevel-list-from-xhtml-to-docx-a-few-concrete-lists-are-gener

vadimyen commented 10 months ago

I have the same problem