Hi,
I have a use case to copy the existing table in a document and add it to the same document right after the existing table.
Can any one help me with this?
Thanks :)
It is currently Tue Feb 25, 2025 12:58 am
WordprocessingMLPackage wordprocessingMLPackage = Docx4J.load(new File(System.getProperty("user.dir") + "/uploads/chartCopy.docx"));
Relationship rel = relationshipsPart.getRelationshipByType(Namespaces.SPREADSHEETML_CHART);
Part part = relationshipsPart.getPart(rel);
System.out.println(part.getPartName().getName() );
wordprocessingMLPackage.getMainDocumentPart().addTargetPart(part, RelationshipsPart.AddPartBehaviour.RENAME_IF_NAME_EXISTS);
wordprocessingMLPackage.save(new File(System.getProperty("user.dir") + "/uploads/chartCopyNew.docx"));
WordprocessingMLPackage wordPackage = WordprocessingMLPackage.createPackage();
MainDocumentPart mainDocumentPart = wordPackage.getMainDocumentPart();
mainDocumentPart.addStyledParagraphOfText("Title", "Hello World!");
mainDocumentPart.addParagraphOfText("Test");
File exportFile = new File("hello.docx");
wordPackage.save(exportFile);
Total posts 10143 • Total topics 2852 • Total members 2083