Dear,
We would like to use Aspose.Word product to extract Tables from DOCX document and convert to Table XML in String or Java object. Is there any way to do that?
For now I only iterate through nodes of the aspose.words table like this…
public Object renderOfficeTableToST36ElementAsObject(final com.aspose.words.Table officeTable){
try {
String tableMl = “”;
// Get the index of the table node as contained in the parent node of the table
int tableIndex = officeTable.getParentNode().getChildNodes().indexOf(officeTable);
// Iterate through all rows in the table
for (Row row : officeTable.getRows()) {
int rowIndex = officeTable.getRows().indexOf(row);
// Iterate through all cells in the row
for (Cell cell : row.getCells()) {
int cellIndex = row.getCells().indexOf(cell);
// Get the plain text content of this cell.
//String cellText1 = cell.toString();
String cellText = cell.toString(SaveFormat.TEXT).trim();
//Add cell to docxconversion.st36.content.Table??
}
}
StringReader reader = new StringReader(tableMl);
return unmarshaller.unmarshal(reader);
} catch (Exception e) {
LOGGER.error(TABLE_ML_CONVERSION_EXCEPTION, e);
return null;
}
}
A lot of thanks!