Hi team,
Expecting a work around solution to extract only image from docx using paragraph nodes in JAVA
Regards
Priya DharshiniOverlay.zip (149.6 KB)
OverlayProblem.zip (151.2 KB)
Hi team,
Expecting a work around solution to extract only image from docx using paragraph nodes in JAVA
Regards
Priya DharshiniOverlay.zip (149.6 KB)
OverlayProblem.zip (151.2 KB)
Hi Priya,
Thanks for your inquiry. Please use following code example achieve your requirement.
Document doc = new Document(MyDir + "Problem.docx");
int i = 1;
NodeCollection paragraphs = doc.getChildNodes(NodeType.PARAGRAPH, true);
for (Shape shape : (Iterable<Shape>) doc.getChildNodes(NodeType.SHAPE, true))
{
Document dstDoc = new Document();
NodeImporter importer = new NodeImporter(doc, dstDoc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
Node newNode = importer.importNode(shape, true);
dstDoc.getFirstSection().getBody().getFirstParagraph().appendChild(newNode);
dstDoc.save(MyDir + "output"+i+".docx");
i++;
}
Best Regards,
Tahir Manzoor
Thanking You
Regards
Priya Dharshini J P