@Mahesh39 You should process each column in your table to get the desired output. For example see the following code:
Document doc = new Document("C:\\Temp\\in.docx");
// Update list labels since captions in the document are list with FigX label.
doc.updateListLabels();
// Get the table.
Table table = doc.getFirstSection().getBody().getTables().get(0);
// Suppose each row in the table has the same number of cells.
for (int colIdx = 0; colIdx < table.getFirstRow().getCells().getCount(); colIdx++)
{
// Suppose the last row contains a cation and the first row contains the shape.
String caption = table.getLastRow().getCells().get(colIdx).toString(SaveFormat.TEXT).trim();
System.out.println(caption);
if (caption.startsWith("Fig"))
{
// Get the shape.
Node image = table.getFirstRow().getCells().get(colIdx).getChild(NodeType.SHAPE, 0, true);
if (image == null)
continue;
// Save the shape.
Document tmp = (Document)doc.deepClone(false);
tmp.ensureMinimum();
Node dstImage = tmp.importNode(image, true, ImportFormatMode.USE_DESTINATION_STYLES);
tmp.getFirstSection().getBody().getFirstParagraph().appendChild(dstImage);
tmp.save("C:\\Temp\\" + caption + "_" + colIdx + ".pdf");
}
}