Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get bookmarks out of a Word document 1

Status
Not open for further replies.

LuckyKoen

Programmer
Feb 14, 2005
57
BE
I would like to get the items of the table of contents out of a Word document along with their corresponding reference number (like _Toc123456) for each item. So far I have found various ways to get the _Toc numbers out of a Word document but I can't do much with just the numbers.

Are there any easy ways to do this with java ? If not then I'd like to know how you can do it in VB.
 
Could you please:

1. state what you HAVE done? You state you have got the _ToC numbers out. Clarify how you did so.

2. what, EXACTLY, are you trying to do? This follows #1 above. You have the numbers (actually their name really), but say you can not do much with that. That depends oln what you want to do.

Bookmarks are persistent named range objects. Are you trying to get the location of them? Are you trying to get their text? Are you trying to get their order?

What exactly do you mean by "get bookmarks out of a Word document"? "Out"?

Gerry
 
In a word document I have a table of contents. Each item in this list links to the corresponding paragraph in the Word document. For examply you could have :

1. Introduction
2. Summary
3. ...

Where Introduction has number _Toc99338683 appointed to it, Summary has _Toc99338684 and so on. I would like to get the items in the table of contents with their _Toc number. I have a perl script that uses the Ole module but it only shows the _Toc numbers, not Introduction, Summary, ...
I also converted the Word document to XML But Word didn't place the number and the text under the same parent.

 
A few tips that might be useful:
Usually a table of contents automatically generates based on default headings or headings you specify.
A common practice is to add page headers/footers that reflect chapter titles. This actually does what you want. It works as follows from Word:
Insert_Field
Categories: Links and references
Field names: StyleRefThe related options you choose as it suits your needs.
Once you have this in the header or footer, you can extract it from the document.
Even if you are not interested in displaying it in the document, you can have it hidden or colored same as background.

Hope that helps.


Eman_2005
Technical Communicator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top