AntonOellerer opened a new pull request, #389: URL: https://github.com/apache/poi/pull/389
Up until now, the `XWPFDocument#insertNew[Paragraph|Table](XmlCursor)` methods were only able to insert the elements if they were present in the `XWPFDocument`-internal lists representing the top-level objects not nested in other elements (`XWPFDocument.paragraphs`/`XWPFDocument.tables`). This commit updates the insertion code for both methods such that objects can also be inserted if the `XmlCursor` does not point to an element in the top-level list but to a nested object (for example a paragraph in a table). This is done by first figuring out the path to the cursor by repeated calls to `XmlCursor#toParent()`, and then traversing down the `XWPFDocument` internal structure to find the parent object where the new paragraph or table should be inserted. Tests verifying this behavior have been added. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org For additional commands, e-mail: dev-h...@poi.apache.org