Rather, in my case, I've got a TOC that was created (using Word), and I'd like to update that TOC with content that I've added via docx4j. Not sure what the TOC actually is .. is it just XML like any other P/R/Text? Do we just need to manually update it?

Searching for "Table of Contents" did not reveal that forum topic -- I only found this one from a "TOC" search.

Searching for "Table of Contents" (with or without quotes) yields:

"The following words in your search query were ignored because they are too common words: contents table of.You must specify at least one word to search for. Each word must consist of at least 3 characters and must not contain more than 14 characters excluding wildcards."

I know -- phpbb is a pain. I also administer a phpbb board -- although I've upgraded to 3.0, which is much better. If you haven't done a lot of custom modification, the upgrade process is very easy.. might be worth it.

Jason,Coming back to creating the TOC, as per your post you had given a link to another thread [which I had checked earlier], it is using the XML. I wanted to know if there is a method available which would create TOC directly?Thanks for your help once again.

Thanks Jason,I am trying with those classes, however FldChar.java is giving problem. I have attached the source code [AddTOC.zip ]which I have written.It is asking for the @XmlRootElement annotation as below:javax.xml.bind.MarshalException - with linked exception:[com.sun.istack.internal.SAXException2: unable to marshal type "org.docx4j.wml.FldChar" as an element because it is missing an @XmlRootElement annotation] at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source) at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(Unknown Source) at org.docx4j.openpackaging.parts.JaxbXmlPart.marshal(JaxbXmlPart.java:176) at org.docx4j.openpackaging.parts.JaxbXmlPart.marshal(JaxbXmlPart.java:153) at org.docx4j.openpackaging.io.SaveToZipFile.saveRawXmlPart(SaveToZipFile.java:206) at org.docx4j.openpackaging.io.SaveToZipFile.saveRawXmlPart(SaveToZipFile.java:194) at org.docx4j.openpackaging.io.SaveToZipFile.savePart(SaveToZipFile.java:402) at org.docx4j.openpackaging.io.SaveToZipFile.addPartsFromRelationships(SaveToZipFile.java:365) at org.docx4j.openpackaging.io.SaveToZipFile.save(SaveToZipFile.java:164) at org.docx4j.openpackaging.io.SaveToZipFile.save(SaveToZipFile.java:101) at org.docx4j.openpackaging.packages.WordprocessingMLPackage.save(WordprocessingMLPackage.java:202) at com.apcc.reports.docx4j.AddTOC.main(AddTOC.java:81)Caused by: com.sun.istack.internal.SAXException2: unable to marshal type "org.docx4j.wml.FldChar" as an element because it is missing an @XmlRootElement annotation at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.reportError(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayReferenceNodeProperty.serializeListBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsSoleContent(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayReferenceNodeProperty.serializeListBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsSoleContent(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayReferenceNodeProperty.serializeListBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.ArrayERProperty.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsXsiType(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsSoleContent(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(Unknown Source) ... 13 more

// You aren't adding your hyperlink to the P // You'll need something like p.getParagraphContent().add(h); // In what follows, you should be adding the content // to the h, not the p, but I'll leave that to you

Searching for "Table of Contents" did not reveal that forum topic -- I only found this one from a "TOC" search.

Searching for "Table of Contents" (with or without quotes) yields:

"The following words in your search query were ignored because they are too common words: contents table of.You must specify at least one word to search for. Each word must consist of at least 3 characters and must not contain more than 14 characters excluding wildcards."

I know -- phpbb is a pain. I also administer a phpbb board -- although I've upgraded to 3.0, which is much better. If you haven't done a lot of custom modification, the upgrade process is very easy.. might be worth it.

Thanks for pointing this out.

When I searched the forum, I got the same message.

Workaround (for now) is to use the "Search Plutext & msdn" search option instead, which is powered by Google. I'll modify the page to include this hint.

Hello Jason,Thanks once again for the workaround and also the comments.1> When I run this program only a bookmark is coming and it is not a TOC. I am trying to understand what each class meant for but not able to achieve much.

2> I tried generating TOC using the XML and that one is generating TOC however not adding Headings etc. Also, If I right click and select 'update field' option then I get error:"Error! Bookmark not defined"Forgive me if I am asking too many things but TOC is giving me nice time.

hi Jason,I tried following code but it didn't seems working.Haven't got any idea why? I need to generate whole TOC from scratch. I manage to generate report but now its Contents didn't seems to generate.Can you suggest what am I doing wrong?