* @author Andreas Br�ker
*/
public ITextTable constructTextTable(int rows, int columns)
throws TextException {
if (columns > ITextTable.MAX_COLUMNS_IN_TABLE) {
throw new TextException("The submitted table is not valid");
}
try {
XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory) UnoRuntime
.queryInterface(XMultiServiceFactory.class, textDocument
.getXTextDocument());
Object newTable = xMultiServiceFactory
.createInstance("com.sun.star.text.TextTable");
XTextTable newTextTable = (XTextTable) UnoRuntime.queryInterface(
XTextTable.class, newTable);
newTextTable.initialize(rows, columns);
TextTable textTable = new TextTable(textDocument, newTextTable);
return textTable;
} catch (Exception exception) {
TextException textException = new TextException(exception
.getMessage());
textException.initCause(exception);
throw textException;
}
}