Is there a way to delete a section and its contents programmatically using docx4j?
My requirement is to have a document template with 4 sections relating to product information about products A, B, C and D. The product information for each of them will have a combination of static text and dynamic data that will be generated at runtime and the dynamic info resides in the database tables. I am planning to include content controls under each product section for the dynamic data and once I get the data from the tables in the mid-tier, docx4j code will populate the content controls with the appropriate data.
If the user thinks he only needs to see A, B and D in the resulting document, my code should be able to not show any content from section C from the template and its static text and generate the final document with A, B and D sections.
Any ideas how to create such a template and appropriately delete sections? is there a way to do this?