incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dali Liu <wawal...@gmail.com>
Subject Re: Add an document in another document
Date Fri, 01 Mar 2013 20:15:57 GMT
2013/3/1 Shemeer AT <shemeerat@hotmail.com>

>
>
>
> Hello,
>
>
>
> I am new to this project.
>
> I would like to add one document in another document.
>
> How I can achieve this using java.
>

Yes, you can do this by the latest ODF Simple JAVA api. It's very easy,
here is the sample codes.
    public void testinsertContentFromDocumentAfter() {
        TextDocument src1 = TextDocument.loadDocument("SourceDocument.odt");
        TextDocument target1 =
TextDocument.loadDocument("TargetDocument.odt");
        Paragraph p1 = target1.getParagraphByIndex(2, true);
        target1.insertContentFromDocumentAfter(src1, p1, false);

target1.save(ResourceUtilities.newTestOutputFile("TestInsertDocumentWithStyleAfter.odt"));
    }

>
> Please help me.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message