Ok, the table of contents is not a page, instead it is a field. Support is somewhat limited, but I have found that the easy way to create one is by following my Stack Overflow answer here: https://stackoverflow.com/a/40264237/2296441. This creates an automatic table of contents that uses Heading styles to create the table of contents. It finds the page numbers based on the way Microsoft Word renders the pages. Note that the values in the table of contents field are just cached values, but if the document changes, it is re-generated, so you can't change the table of contents by adjusting the cached values. You have to adjust the Heading text (the text that is styled by one of the Heading styles). The page numbers are generated automatically as the document changes.
On Mon, Sep 23, 2019 at 2:37 AM Bhavya Kothapally < [email protected]> wrote: > Actually I want to modify the contents page in the document. > > I tried to modify the same document but it is not possible using sdt, just > for trial I have modified the text and saved it as a string and copied that > to a new document. > > > > -- > Sent from: http://apache-poi.1045710.n5.nabble.com/POI-User-f2280730.html > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
