When I already know a TOC item
(MyDoc.TablesOfContents[1].Range.Paragraphs[1]), how can i select the
corespending content in the document?

What I am trying to do is that I have a TOC like:

Section 1
-- Section 1.1
-- Section 1.2

I need to copy the part of the document linked to the Section 1.2.
thanks for help

Tomcat

Re: One more TOC question by Jonathan

Jonathan
Fri Jan 07 16:27:32 CST 2005


"tomcat" <cn_tomcat@hotmail.com> wrote in message
news:1105135507.200117.47040@f14g2000cwb.googlegroups.com...
> When I already know a TOC item
> (MyDoc.TablesOfContents[1].Range.Paragraphs[1]), how can i select the
> corespending content in the document?
>
> What I am trying to do is that I have a TOC like:
>
> Section 1
> -- Section 1.1
> -- Section 1.2
>
> I need to copy the part of the document linked to the Section 1.2.
> thanks for help
>
> Tomcat
>

Hi Tomcat

If the paeragraph has a PAGEREF field included (making the page number into
a hyperlink) then you can extract the bookmark from the Code property fo the
field. That bookmark makes the heading paragraph. If you want the range of
the body text below it, then get the bookmark of the following TOC entry
page number, and then get the range from the start of the current bookmark
to the start of the next.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Re: One more TOC question by tomcat

tomcat
Fri Jan 07 16:59:16 CST 2005

Thanks for reply, I could find the PageRef property in the paeragraph
object, I am using c#. any idea?


Re: One more TOC question by Jonathan

Jonathan
Fri Jan 07 19:34:25 CST 2005


"tomcat" <cn_tomcat@hotmail.com> wrote in message
news:1105138756.677706.243280@z14g2000cwz.googlegroups.com...
> Thanks for reply, I could find the PageRef property in the paeragraph
> object, I am using c#. any idea?

Paragraph(n).Range.Fields(1).Code.Text

That property will give you the text of the field code, which will be
something like this

" PAGEREF _ToC3452435623 "

The second word is the name of the bookmark marking the heading in the body
of the document


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup


Re: One more TOC question by tomcat

tomcat
Fri Jan 07 20:29:28 CST 2005

thanks a lot