GroupDocsGists
10/24/2017 - 1:09 PM

Examples-GroupDocs.Assembly.Examples.Java-src-main-java-com-groupdocs-assembly-examples-GenerateReport-loadDocTableSetWithCustomOptions.java

// For complete examples and data files, please go to https://github.com/groupdocs-assembly/GroupDocs.Assembly-for-Java
// Load document tables using custom options.
DocumentTableSet tableSet = new DocumentTableSet(CommonUtilities.getDataPath(srcDocument), new CustomDocumentTableLoadHandler());
 
// Ensure that the second table is not loaded.
assert tableSet.getTables().getCount() == 2;
assert tableSet.getTables().get(0).getName().equals("Table1");
assert tableSet.getTables().get(1).getName().equals("Table3");
 
// Ensure that default options are used to load the first table (that is, default column names are used).
assert tableSet.getTables().get(0).getColumns().getCount() == 2;
assert tableSet.getTables().get(0).getColumns().get(0).getName().equals("Column1");
assert tableSet.getTables().get(0).getColumns().get(1).getName().equals("Column2");
 
// Ensure that custom options are used to load the third table (that is, column names are extracted).
assert tableSet.getTables().get(1).getColumns().getCount() == 2;
assert tableSet.getTables().get(1).getColumns().get(0).getName().equals("Name");
assert tableSet.getTables().get(1).getColumns().get(1).getName().equals("Address");