*/
public void reduceDocumentTo(int topics) throws Exception {
// we never remove the first topic...
if (topics <= 0)
topics = 1;
XTableRows tableRows = table.getRows();
int targetNumOfRows = topics * rowsPerTopic + 1;
if (tableRows.getCount() > targetNumOfRows)
tableRows.removeByIndex(targetNumOfRows , tableRows.getCount() - targetNumOfRows );
formatLastRow();
while ( writtenTopics.size() > topics )
writtenTopics.remove(topics);
}