Greenhorn
Greenhorn

Reputation: 668

How to read bookmarks value in word document, C++\CLI using open xml sdk 2.0

I've created a word document using openXML SDK in C++\CLI in which I've entered Bookmarks,

I need to open that word document and search for the bookmarks present in it and replace it with some text value.

Please suggest the above with sample code or any links which I can refer.

Thanks in advance

Upvotes: 0

Views: 694

Answers (1)

David Thielen
David Thielen

Reputation: 32996

I suggest a lot more specific. A bookmark can have paragraphs, images, tables, textboxes, etc. all in it. It can also start in the middle of a table and end outside the table. So replacing what's inside it can be very problematic.

So I'm going to take a guess as to what you want and from that might have an answer for you. I am guessing you want something where you place tags in the document and then your program can replace those tags with data. Instead of bookmarks use fields. There are a number of mailmerge fields that work great for this.

If this will work for you, then for the actual code, Descendents is the main thing you need.

Upvotes: 2

Related Questions