A
Andreas Baus
I have some difficulties trying to extract entries form a Table of
Contents in a Word document. What I want is, basically, to retrieve
for each entry in a ToC the name (i.e. the text) of the entry and the
point it's referring to (i.e. the name of the hidden bookmark). My
first idea was to use the Paragraphs collection on the range of the
ToC; but then I'm faced with the problem that, while it works quite
well for all Paragraphs except the very first and very last, for both
of the latter the Fields collection contains *all* the fields of the
entire ToC, leading to a number of special case branches, which rely
on a number of assumptions I made about the structure of the data in
the collections in question. Consequently, I'm not 100% sure my
solution is going to be water-proof in all cases; all in all I'm
wondering (or rather hoping) that there is a simpler, more elegant and
most of all more reliable method for accomplishing what I'm trying to
do. If anyone here has any idea's, I'd be eager to hear them. Thanks.
Contents in a Word document. What I want is, basically, to retrieve
for each entry in a ToC the name (i.e. the text) of the entry and the
point it's referring to (i.e. the name of the hidden bookmark). My
first idea was to use the Paragraphs collection on the range of the
ToC; but then I'm faced with the problem that, while it works quite
well for all Paragraphs except the very first and very last, for both
of the latter the Fields collection contains *all* the fields of the
entire ToC, leading to a number of special case branches, which rely
on a number of assumptions I made about the structure of the data in
the collections in question. Consequently, I'm not 100% sure my
solution is going to be water-proof in all cases; all in all I'm
wondering (or rather hoping) that there is a simpler, more elegant and
most of all more reliable method for accomplishing what I'm trying to
do. If anyone here has any idea's, I'd be eager to hear them. Thanks.