public void insertTextContentBefore(ITextContent newTextContent, ITextContent textContent) throws TextException {
try {
XRelativeTextContentInsert xRelativeTextContentInsert = (XRelativeTextContentInsert)UnoRuntime.queryInterface(XRelativeTextContentInsert.class, xText);
if(newTextContent instanceof ITextTable) {
IParagraph paragraph = constructNewParagraph();
xRelativeTextContentInsert.insertTextContentBefore(paragraph.getXTextContent(), textContent.getXTextContent());
xText.insertTextContent(paragraph.getXTextContent().getAnchor(), newTextContent.getXTextContent(), false);
xText.removeTextContent(paragraph.getXTextContent());
}
else {
xRelativeTextContentInsert.insertTextContentBefore(newTextContent.getXTextContent(), textContent.getXTextContent());