Hi,
inserting Sections:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Text_Sections
inserting Documents at a cursors position:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Text/Inserting_Text_Files
Please be aware that instead of using a file-URL you can also insert
from a Stream.
Regards
Peter
Grover Blue schrieb:
Does anyone have an example of inserting a section and merging two
XTextDocuments?
I'm stuck. Below is what I have so far, but I'm not sure how to insert the
second document.
public void appendDocument(XTextDocument document1, XTextDocument document2)
throws IllegalArgumentException, java.lang.Exception {
XText xDocText = document1.getText();
XTextCursor xOrigDocTextCursor = xDocText.createTextCursor();
XNamed xChildNamed;
XTextContent xChildContent;
XPropertySet xOrigDocTextCursorProp;
xOrigDocTextCursor.gotoEnd(false);
xDocText.insertControlCharacter(xOrigDocTextCursor,
ControlCharacter.PARAGRAPH_BREAK, false);
xOrigDocTextCursorProp = (XPropertySet)
FileManager.getOOoUnoRuntimeQueryInterface(
XPropertySet.class,
xOrigDocTextCursor);
xOrigDocTextCursorProp.setPropertyValue("BreakType",
BreakType.PAGE_BEFORE);
xChildNamed = (XNamed) FileManager.getOOoUnoRuntimeQueryInterface(
XNamed.class,
FileManager.getOOoUnoRuntimeCreateInstance("com.sun.star.text.TextSection"));
xChildNamed.setName("NewSection");
xChildContent = (XTextContent)
FileManager.getOOoUnoRuntimeQueryInterface(
XTextContent.class,
xChildNamed);
/* Add document2 to the new section somehow */
xDocText.insertTextContent(xOrigDocTextCursor, xChildContent,
false);
Thanks
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org