I need to process mergefields within specific bookmarks.
If I can get the FieldStart nodes that are between the start and End bookmark nodes, that would be perfect.
Given an approach I used to get all the fieldStarts from the document:
I initially tried something like
Dim myNode as Node = myBookmark.BookmarkStart
While not (myNode.NodeType = NodeType.BookmarkEnd)
dim temp as NodeCollection
temp = myNode.GetChildNodes(NodeType.FieldStart, True)
myNode = myNode.NextSibling
But “GetChildNodes” is regretfully only available on the document node itself.
Is there another way to get the FieldStart nodes I need?
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for your request. I think, you can easily achieve what you need using DocumentVisitor:
Just start collection FieldStart nodes when you visit BookmarkStart of the appropriate bookmark and finish collection when you visit it’s BookmarkEnd.
Please let me know if you need more assistance, I will be glad to help you.
That indeed seems to fulfill my needs in a nice and clean way.