SandroRiz
SandroRiz

Reputation: 1107

Retrieve the position of a content control inside a word document

Is it possible in VSTO to get the position (that is the page number or the section/chapter) where a content control is placed ? Eg. I would like to retrieve that the ctrl Req234 is on chap. 4.1 (headings) or on page xy

4. Title Lorem ipsum
 4.1 Subtitle 
 Lorem ipsum 
 [Req234]
5. Title

The control could be surrounded by a Bookmark if it is easier to retrieve bookmark position.

Upvotes: 1

Views: 1223

Answers (1)

SandroRiz
SandroRiz

Reputation: 1107

Find that the Range has this method to achieve my task

contentcontrol.Range.get_Information(WdInformation.wdActiveEndPageNumber);

https://msdn.microsoft.com/en-us/library/bb213848(v=office.12).aspx

Upvotes: 2

Related Questions