XText xText = textDocumentTextShape.getXText();
if(xText != null){
XTextCursor xTextCursor = xText.createTextCursor();
xTextCursor.gotoStart(false);
IViewCursor viewCursor = textDoc.getViewCursorService().getViewCursor();
ITextRange textRange;
try {
textRange = textDoc.getTextService().getTextContentService().constructNewTextRange(textDoc, xTextCursor.getStart());
} catch (TextException e1) {
textRange = null;
e1.printStackTrace();
}
if(textRange == null){
return;
}
viewCursor.goToRange(textRange, false);
try {
StringReader reader = new StringReader(textInfo.getText());
InputStream is = new ReaderInputStream(reader);
viewCursor.getTextCursorFromStart().insertDocument(is, RTFFilter.FILTER);
// viewCursor.getTextCursorFromStart().insertDocument(is, HTMLFilter.FILTER);
} catch (NOAException e) {
e.printStackTrace();
}
}