[ 
https://issues.apache.org/jira/browse/ODFTOOLKIT-330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

DaLi Liu updated ODFTOOLKIT-330:
--------------------------------

    Attachment: 330_TableSelection.patch

The implement of replacewith Table, similar with FieldSelection.java
Javadoc and testcase included.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        /**
         * Replace the content with a Table , the table can be in the same 
TextDocument or in a different Document.
         * 
         * @param paragraph the reference table to replace.
         * 
         * @return the new Table in the TextDocument
         */
        public Table replaceWithTable(Table table)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Using: To use it please refer to TableSelectionTest.java
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TextSelection item = (TextSelection) search.nextSelection();
                                                TableSelection 
nextTableSelection=new TableSelection(item);
                                                Table 
table=sourcedoc.getTableByName("Table1");
                                                Table newtable = 
nextTableSelection.replaceWithTable(table);


   
                
> Improve the method TextSelection.replaceWith(String). new param types support
> -----------------------------------------------------------------------------
>
>                 Key: ODFTOOLKIT-330
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-330
>             Project: ODF Toolkit
>          Issue Type: Improvement
>          Components: simple api
>    Affects Versions: 0.8.6
>            Reporter: DaLi Liu
>             Fix For: 0.8.6, 0.8.7
>
>         Attachments: 330_ImageSelection.patch, 330_ParagraphSelection.patch, 
> 330_TableSelection.patch
>
>   Original Estimate: 672h
>  Remaining Estimate: 672h
>
> With the clasees TextNavigation and TextSelection, user can generation a 
> report base on some templates very easily. The method 
> TextSelection.replaceWith(String) provides an easy way to replace
> locate and replace placeholders in a document by a concrete text. However 
> that replacement should not only be limited to simple text strings but also 
> for more complex pieces of content.
> So proposal to add new replaceWith method in TextSelection.java
> 1. public void replaceWith(Table table)
> The text represented by the TextSelection object should be replaced by the 
> table
> provided. If the TextSelection object does not contain a paragraph of its 
> own, but rather is part of a paragraph, then this paragraph should be split. 
> that mean the exist paragraph split to two new paragraphs,the table be insert 
> between these two new paragraphs.
> 2.public void replaceWith(Image image)
> The text represented by the TextSelection object should be replaced by an 
> image. The image needs to replace the TextSelection exactly in-place, that 
> means: if positioned within the flow of a text paragraph, the replacement 
> should be in that very position and not at the beginning, or end of the 
> enclosing paragraph.
> 3.public void replaceWith(Paragraph p)
> The text represented by the TextSelection object should be replaced by a 
> paragraph. If the replacement is within a paragraph, it may be required to 
> split that paragraph.  that mean the exist paragraph split to two new 
> paragraphs,the Paragraph be insert between these two new paragraphs.
> 4.public void replaceWith(TextDocument document)
> Alike the replacement of a table, it should be possible to replace the 
> TextSelection with the content of a complete documents. This may require that 
> the paragraph where the replacement takes place needs to be split into two 
> paragraphs first.
> 5.public void replaceWith(Field field)
> The text represented by the TextSelection object should be replaced by the 
> field provided. 

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