Hello,
How can I set CTShapeProperties (of DML package) to the image/picture that I am trying to insert in docx using docx4j? Is it even possible to use DML classes while creating docx using docx4j?
Thanks
It is currently Sat Nov 23, 2024 7:59 pm
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 10111 • Total topics 2842 • Total members 2074