Hi Devin , Got it, I will use the version 0.7 to replace 0.86. Thanks for your comments.
2012/8/10 Devin Han <[email protected]> > Hi DaLi, > > Thanks for your contribution! > I see " * @since 0.8.6" in the javadoc. But 0.8.6 is a version number of > ODFDOM, not Simple API. > The latest release version is 0.7. Pls verify. > Thanks again and very happy to see new feature was added to Simple API ;) > > > > > 2012/8/8 DaLi Liu (JIRA) <[email protected]> > > > > > [ > > > https://issues.apache.org/jira/browse/ODFTOOLKIT-329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel > ] > > > > DaLi Liu updated ODFTOOLKIT-329: > > -------------------------------- > > > > Attachment: tocsupport.patch > > > > Dear all, > > I have add two new Simple APIs to generate a table of content in the text > > document. Please have a review and comments. > > > > Add two methods to TextDocument.java. > > /** > > * Create a new Table Of Content to this document before the > > reference > > * paragraph. The additional paragraph styles list will be > > included in the > > * TOC. Because until you do a full layout of the document, > taking > > into > > * account font metrics,line breaking algorithms, hyphenation, > > image > > * positioning, "orphan and widow" rules, etc., you don't know > > what content > > * is on which page. So all the page numbers in TOC are be set > > value "1". > > * Please update the page numbers from AOO Menus: > > Tools->Update->All Indexes > > * and Tables. If additionalStyle is null then call > > createDefaultTOC(). > > * > > * @param refParagraph > > * the reference paragraph before where the TOC > > inserted. > > * @param additionalStyle > > * the additional paragraph styles that you want to > > include in > > * the TOC > > * @param before > > * true:insert TOC before the reference paragraph. > > * false:insert TOC after the reference paragraph. > > * @since 0.8.6 > > */ > > public TextTableOfContentElement createTOCwithStyle(Paragraph > > refParagraph,TOCStyle additionalStyle, boolean before) > > > > /** > > * Create a new Table Of Content to this document before the > > reference > > * paragraph. Because until you do a full layout of the document, > > taking > > * into account font metrics,line breaking algorithms, > > hyphenation, image > > * positioning, "orphan and widow" rules, etc., you don't know > > what content > > * is on which page. So all the page numbers in TOC are be set > > value "1". > > * Please update the page numbers from AOO Menus: > > Tools->Update->All Indexes > > * and Tables > > * > > * @param refParagraph > > * the reference paragraph where the TOC be inserted. > > * @param before > > * true:insert TOC before the reference paragraph. > > false:insert > > * TOC after the reference paragraph. > > * @since 0.8.6 > > */ > > public TextTableOfContentElement createDefaultTOC(Paragraph > > refParagraph, boolean before) > > > > > > TOCStyle.java represents the additional paragraph styles list that you > > want to include in the TOC. > > > > > > TableOfContentTest.java is the test case for these two new API. > > > > > > > Add a new Simple API to generate a table of content in text document > > > -------------------------------------------------------------------- > > > > > > Key: ODFTOOLKIT-329 > > > URL: > > https://issues.apache.org/jira/browse/ODFTOOLKIT-329 > > > Project: ODF Toolkit > > > Issue Type: New Feature > > > Components: simple api > > > Affects Versions: 0.8.6 > > > Reporter: DaLi Liu > > > Fix For: 0.8.6 > > > > > > Attachments: tocsupport.patch > > > > > > Original Estimate: 672h > > > Remaining Estimate: 672h > > > > > > Dear all, > > > I want to generate a table of content by ODF toolkit Simple API. But it > > seems that there doesn't exist such method. So I proposal to add a new > API > > createTOC to Simple API. > > > Specification: parameters for the new API are: 1. position/location of > > TOC, 2. TOC style to be used > > > ODFToolkit API: TextDocument.createTOC(positionElement, TOCStyle). > > > Discuss with Rob Weir: > > > Rob: > > > Also, it would be good to discuss how you will enter a ToC. If > you > > > do this operation in a word processor, like OpenOffice, you see it > > > does two things: > > > 1) Enter the markup for <text:table-of-content> that defines the > > > structure and style relations for the table of contents. > > > 2) Gather the header text from elsewhere in the document and enter > > > that, along with page references, into a <text:index-body> > > > Doing #1 is easy. But #2 is very difficult. Why? Because until > you > > > do a full layout of the document, taking into account font metrics, > > > line breaking algorithms, hyphenation, image positioning, "orphan > and > > > widow" rules, etc., you don't know what content is on which page. > > > DaLi: yeah, you are right, the page number will be difficult issue. > > > Rob: > > > So the easiest thing is to just do #1 and then have the user do an > > > "Update Table" operation in the word process the next time the > > > document is loaded. > > > Dali:I will try to do #1 first. > > > Rob: > > > Next easiest is to collect the header text to put in the ToC, but > not > > > try to calculate the page numbers, leaving that to be calculated > when > > > the document is loaded in a full word processor. > > > > > > Dali:After finish #1, will consider this. > > > Any comments are welcome > > > > -- > > This message is automatically generated by JIRA. > > If you think it was sent incorrectly, please contact your JIRA > > administrators: > > https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa > > For more information on JIRA, see: > http://www.atlassian.com/software/jira > > > > > > > > > -- > -Devin >
