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

Free Support Forum - aspose.com

Value from table column not parsed

Value from Sr No. column (attached document) is not parsed and I am getting blank instead.

Code snippet is here -


public class App 
{
    public static final String fileName = "tables-issue.docx";

    public static void main( String[] args ) throws Exception {
        AsposeUtil.loadLicense();
        Document doc = new Document(fileName);
        NodeCollection tables = doc.getChildNodes(NodeType.TABLE, true);
        for (Object node : tables){
            if (node instanceof Table) {
                Table table = (Table) node;
                RowCollection rows = table.getRows();
                for(int i = 0; i< rows.getCount(); i++) {
                        Row row = rows.get(i);
                        System.out.println("---- Row start -------"+(i+1));
                        CellCollection cells = row.getCells();
                        for (int j = 0; j < cells.getCount(); j++) {
                            System.out.println("Cell - " + j + " data =" + cells.get(j).getText().trim());
                        }
                    System.out.println("---- Row End-------"+(i+1));
                }
            }
        }
    }
}
 

tables-issue.docx (16.5 KB)

@hkcw3 The problematic text in “S. No.” column is not exported because it is a list labels. You could use the Paragraph.ListLabel.LabelString to get the list label value. Please note that you should also call the Document.UpdateListLabels() method to update list labels in Aspose.Words DOM to the actual value.