We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Retrieving Table cell data and Image at the same time to a single entity

Hi, I have a problem in retrieving image and the data in the table cells at the same time which belongs to a single entity. I can retrieve the data from the cells but not the image source. It does not go into the (else if statement). I have also tried using the code in the programmer guide. I could retrieve the image but not together with the table cells. I had attached a sample copy of the document that I need to retrieve the data from. Could anyone help me? Thanks in advance!

The code below is the code for opening and retrieving the data from the document:
Note: Dish is my object class. I want to save the dish image and its data into the dish class and using dishList to save the dish and return the dishList.

public static ArrayList openDishDoc(String fileName) throws Exception {
InputStream stream = new FileInputStream(fileName);
Document doc = new Document(stream);
ArrayList dishList = new ArrayList();
Section section = doc.getSections().get(0);
Body body = section.getBody();
for (Node node = body.getFirstChild(); node != null; node = node.getNextSibling()) {
Dish dish = new Dish();
if (node.getNodeType() == NodeType.TABLE) {
Table table = (Table) node;
for (int i = 0; i < table.getRows().getCount(); i++) {
Row row = (Row) table.getRows().get(i);
if (row.getFirstCell().toTxt().trim().equalsIgnoreCase(“dish id:”)) {
} else if (row.getFirstCell().toTxt().trim().equalsIgnoreCase(“dish name:”)) {
} else if (row.getFirstCell().toTxt().trim().equalsIgnoreCase(“dish type:”)) {
} else if (row.getFirstCell().toTxt().trim().equalsIgnoreCase(“dish price:”)) {
} else if (row.getFirstCell().toTxt().trim().equalsIgnoreCase(“prepared by:”)) {
} else if (row.getFirstCell().toTxt().trim().equalsIgnoreCase(“description:”)) {
} else if (node.getNodeType() == NodeType.SHAPE) {
Shape shape = (Shape) node;
if (dish.getDishId() != 0) {
return dishList;


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. You cannot get Shape because it is not a direct child of Body. Shape can be a child of Paragraph or SmartTag. Please follow the link to learn more about Aspose.Words Document object Model:


Also, you can use DocumentExplorer (Aspose.Words demo application) to investigate structure of documents.

Please let me know if you need more assistance, I will be glad to help you/

Best regards.