if (t.getTitleElement() != null) {
title = t.getTitleElement().getText();
if (title == null)
title = "";
}
Table table = new Table(title);
List<String> currentRow = new ArrayList<String>();
List<Content> contentList = t.getContentList();
for (@SuppressWarnings("unused")
Content c : contentList) {
int row, col;
String elem = "";
try {
col = t.getTableElement(i).getCol();
row = t.getTableElement(i).getRow();
elem = t.getTableElement(i).getText();
} catch (IndexOutOfBoundsException e) {
// logger.(
// "Error creating table {}, Index out of bound - content = {}",
// table.getName(), c.getText());
break;
}
if (row > 0 && col == 0) {
if ((currentRow.size() == 1)
&& (currentRow.get(0).equals(table.getName()))) {
currentRow = new ArrayList<String>();
} else {
if (!currentRow.isEmpty())
table.addRow(currentRow);
currentRow = new ArrayList<String>();
}
}
currentRow.add(elem);
i++;
}
table.addRow(currentRow);
tables.add(table);
}
article.setTables(tables);