@Test
public void testGetColumnList() {
String tablename = "MyTable";
String testFileName = "TestGetColumnList.odt";
try {
TextDocument document = TextDocument.newTextDocument();
int rowcount = 3, columncount = 3;
String[][] data = new String[rowcount][columncount];
for (int i = 0; i < rowcount; i++) {
for (int j = 0; j < columncount; j++) {
data[i][j] = "string" + (i * columncount + j);
}
}
String[] rowlabels = new String[rowcount];
for (int i = 0; i < rowcount; i++) {
rowlabels[i] = "RowHeader" + i;
}
String[] columnlabels = new String[columncount];
for (int i = 0; i < columncount; i++) {
columnlabels[i] = "ColumnHeader" + i;
}
Table table3 = Table.newTable(document, rowlabels, columnlabels, data);
table3.setTableName(tablename);
document.save(ResourceUtilities.newTestOutputFile(testFileName));
document = loadODTDocument(testFileName);
Table table = document.getTableByName(tablename);
Column tmpColumn;
List<Column> columns = table.getColumnList();
// the code below prints the column value,it shows that the first
// columns value is the same with the last column