You can do it in two ways: manually or automatically.
In this text only the manual way is discussed.
These are the steps to be taken:
In the text itself you select and bookmark the headings that you want in the Table of Contents. (Select text/Insert/Bookmark)
Then add the text that you bookmarked to the Table of Contents. When you have done that,hyperlink the text
of the table of content to the bookmarks
(Insert/Hyperlink/Document/Target).
It should look like this:
Shave
his belly with a rusty razor (this text is hyperlinked to the bookmark)
Put
him in a longboat till his sober
Stick
him in a barrel with a hosepipe on him
Put
him in the bed with the captains daughter
And the original text:
What will we do with
the drunken sailor
What will we do with
the drunken sailor
What will we do with
the drunken sailor
Early in the morning
Way hay and up she
rises
Way hay and up she
rises
Way hay and up she
rises
Early in the morning
Shave his belly with a rusty razor (this text is bookmarked)
Shave his belly with
a rusty razor
Shave his belly with
a rusty razor
Early in the morning
Way hay and up she
rises
Way hay and up she
rises
Way hay and up she
rises
Early in the morning
Put him in a longboat till his sober (this text is bookmarked)
Put him in a
longboat till his sober
Put him in a
longboat till his sober
Early in the morning
Way hay and up she
rises
Way hay and up she
rises
Way hay and up she
rises