Page 1 of 1

Add paragraph and hyperlink to Table Of Contents

PostPosted: Tue Dec 01, 2015 11:14 am
by subnot303640
I want to generate a Table of content document using doc4j. I tried the below sample program and it worked. However, I want the following changes and I am not sure how to do it. I have attached the document which describes what exactly I want.

1. When the user clicks on Heading 1 or Heading 2 in TOC, the cursor is taken to the detailed section. Now I want to show a detailed paragraph for each item like the description about the book / laptop and its price.

2. Is it possible to give hyperlink in the detailed section to the heading 2 items like Java/Oracle/SQL tuning/4 Gb Ram.. On click on these link it should take the specific website like amazon...

How do it. please provide me with a code.

Thanks.

Re: Add paragraph and hyperlink to Table Of Contents

PostPosted: Thu Dec 03, 2015 5:39 am
by subnot303640
Hope my question is clear. Appreciate the help.
Thanks.

Re: Add paragraph and hyperlink to Table Of Contents

PostPosted: Fri Dec 04, 2015 12:39 pm
by jason
You use a ToC field code to generate a table of contents from stuff in the document.

For hyperlinks, you need the \h switch

Experiment in Word until you have the correct toc field, then add this in your Java code.

If you are happy for Word to generate the ToC for you (ie you're ok opening the docx in Word), then job done.

Otherwise, if you need to generate the ToC itself, Docx4j Enterprise Ed can do this for you.