public void addTextArea(Object documentObj, String text, int x, int y, int width, int height) throws Exception { XTextDocument document = (XTextDocument) documentObj; XMultiServiceFactory factory = query(XMultiServiceFactory.class, document); XTextFrame xFrame = create(XTextFrame.class, factory, X_TEXTFRAME); setPositionAndSize(xFrame, x, y, width, height); XText xText = document.getText(); xText.insertTextContent(xText.getEnd(), xFrame, false); appendText(xFrame.getText(), text); }
private void appendText(XText xText, String text) { xText.insertString(xText.getEnd(), text, false); }