10/24/2017 - 1:15 PM

// For complete examples and data files, please go to
String dataFilePath = CommonUtilities.excelDataFile+"/Contracts Data.xlsx";
// Set extracting of column names from the first row.
DocumentTableOptions options = new DocumentTableOptions();
// Use data of the _first_ worksheet.
DocumentTable table = new DocumentTable(dataFilePath, 0, options);
// Check column count, names, and types.
assert table.getColumns().getCount() == 3;
assert table.getColumns().get(0).getName().equals("Client");
assert table.getColumns().get(0).getType() == String.class;
assert table.getColumns().get(1).getName().equals("Manager");
assert table.getColumns().get(1).getType() == String.class;
// NOTE: A space is replaced with an underscore, because spaces are not allowed in column names.
assert table.getColumns().get(2).getName().equals("Contract_Price");
// NOTE: The type of the column is double, because all cells in the column contain numeric values.
assert table.getColumns().get(2).getType() == double.class;
return table;