I found examples of inserting via a file, but I'm confused on how I would go
from a XTextDocument to an input stream.  I guess I'd need to use an
XInputStream object (assuming that is the interface I want to use when
passing the "InputStream" property to XDocumentInsertable), but it's not
clear on how to obtain that from XTextDocument.  You wouldn't happen to have
an example?




On Wed, Mar 4, 2009 at 9:46 AM, Peter Eberlein <
pet....@refofd.verwalt-berlin.de> wrote:

> 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
>
>


-- 
“If the American people ever allow private banks to control the issue of
their currency, first by inflation, then by deflation, the banks...will
deprive the people of all property until their children wake-up homeless on
the continent their fathers conquered... The issuing power should be taken
from the banks and restored to the people, to whom it properly belongs."
-- Thomas Jefferson

"Government big enough to supply everything...is big enough to take
everything you have. The course of history shows that as a government grows,
liberty decreases" --- Thomas Jefferson

www.CampaignForLiberty.org

Reply via email to