I am using evaluation version of aspose words.
I need to add bookmarks to all the sdt (Structured document tag) present in word.
Bookmarks as par my requirement can be added in two ways:
- Two bookmarks to single sdt
a) at the start of the sdt
b) at the end of the sdt - Or Single bookmark enclosing whole sdt. i.e. bookmark starting at the start of sdt and ending at the end of sdt. I am using following code but not getting how to traverse till the end of sdt either to create second bookmark (if using method 1) or to end the bookmark (if using method 2)
Below is the code snippet:
DocumentBuilder builder = new DocumentBuilder(LobjDocument);
NodeCollection nodes = LobjDocument.GetChildNodes(NodeType.StructuredDocumentTag, true);
int iCount = nodes.Count;
LayoutCollector objLayoutCollector = new LayoutCollector(LobjDocument);
LayoutEnumerator objLayoutEnumerator = new LayoutEnumerator(LobjDocument);
foreach (StructuredDocumentTag sdt in nodes)
{
Object obk = objLayoutCollector.GetEntity(sdt);
if (obk != null)
{
objLayoutEnumerator.Current = obk;
builder.MoveTo(sdt);
builder.StartBookmark("start" + sdt.Tag);
builder.WriteLine(" ");
builder.EndBookmark("start" + sdt.Tag);
}
}