[ 
https://issues.apache.org/jira/browse/ODFTOOLKIT-339?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477529#comment-13477529
 ] 

DaLi Liu commented on ODFTOOLKIT-339:
-------------------------------------

I have implement these new methods in TextDocument.java:
         /**
         * Copy text content of the source TextDocument and insert it to the 
current TextDocument
         * after the reference Paragraph, with Styles or without Styles.
         * 
         * @param sourceDocument
         *            the source TextDocument
         * @param referenceParagraph
         *                where the text content of the source TextDocument be 
inserted 
         * @param isCopyStyle
         *            true:copy the styles in source document to current 
TextDocment. 
         *            false:don't copy the styles in source document to current 
TextDocment. 
         */
1.public void insertContentFromDocumentBefore(TextDocument sourceDocument, 
Paragraph referenceParagraph, boolean isCopyStyle)
        /**
         * Copy text content of the source TextDocument and insert it to the 
current TextDocument
         * before the reference Paragraph, with Styles or without Styles.
         * 
         * @param srcDoc
         *            the source TextDocument
         * @param referenceParagraph
         *                where the text content of the source TextDocument be 
inserted 
         * @param isCopyStyle
         *            true:copy the styles in source document to current 
TextDocment. 
         *            false:don't copy the styles in source document to current 
TextDocment. 
         */
2.public void insertContentFromDocumentAfter(TextDocument sourceDocument, 
Paragraph referenceParagraph, boolean isCopyStyle)

And the two test cases be added to TextDocumentTest.java
1.public void testinsertContentFromDocumentBefore() throws Exception
2.public void testinsertContentFromDocumentAfter() throws Exception
One test file "TestInsertDocument.odt" which used by the testcase be added to 
/test/resources/





                
> [Simpe]Add new methods in TextDocument to suport insert a d ocument into an 
> open document
> -----------------------------------------------------------------------------------------
>
>                 Key: ODFTOOLKIT-339
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-339
>             Project: ODF Toolkit
>          Issue Type: New Feature
>          Components: simple api
>    Affects Versions: 0.8.6
>            Reporter: DaLi Liu
>             Fix For: 0.8.6, 0.8.7
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
> Dear all,
> Do you have meet this requirement before?
> Customer want to render a report from other source documents, all the target 
> and source documents are using the same style templates.
> With ODF toolkit API, we can append the content of source documents to target 
> document with styles, but during document insertation the styles existing in 
> the target and the source document are
> added again to the target document.
> Example: Both the report master doc (= target doc) and the inserted doc (= 
> sourcedoc) have the identical style "MinD Standard" defined to it. After 
> appending the source doc to the master doc there three styles in the report 
> master doc: the original style "MinD Standard" and two additional styles 
> named "MinD Standard-ala266c" and MinD Standard-af9e507". The paragraphs from 
> the source doc which were originally formatted with "MinD Standard" are in 
> the master doc now formatted with "MinD Standard-af9e507".
> This is very confusing for users to see for every included source doc the 
> multiple styles included in the target doc.
> So a propose add new methods in TextDocument to meet this requirement:
>    TextDocument.insertContentFromDocumentAfter(docName, positon, isCopyStyle)
>    TextDocument.insertContentFromDocumentBefore(docName, positon, isCopyStyle)
> Parameters for the API are: 1. Name of the source doc to be inserted,  2. 
> Paragraph  location where to put the insert doc,  3. copy the style of the 
> insert doc (Boolean: yes/no)
> if isCopyStyle is yes then insert styles in source document to the master doc.
> if isCopyStyle is no then don't insert styles to source document to the 
> master doc.
> Any comments about this ?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to