Hi Piers,
Thanks for your inquiry.
1) You can get a list of MergeFields i.e. contained inside a bookmark by using the following code snippet:
Bookmark
bookmark = doc.Range.Bookmarks[“fromHere”];
ArrayList
list = ExtractSelectedContent.ExtractContent(bookmark.BookmarkStart,
bookmark.BookmarkEnd, false);
Paragraph
p = (Paragraph)list[0];
NodeCollection fieldStarts = p.GetChildNodes(NodeType.FieldStart,
true);
foreach (FieldStart fieldStart in
fieldStarts)
{
if
(fieldStart.FieldType.Equals(FieldType.FieldMergeField))
{
}
}
Also, please visit the following link for a description of ExtractContent method:
2) If Aspose.Words encounters a problem that can be resolved upon loading a document, it recovers a document silently and does not throw any exceptions.
I hope, this will help.
Best Regards,
Thanks for quick reply. It worked