Adding bookmarks inside of the existing bookmark

Hi,

I have an empty bookmark in the document and I need to add inside of it two additional bookmarks with new paragraph between them.

Example:
[]
should become
[[]
[]]

How can I do that?

Thanks,
Stanislav

Hi Stanislav,

Thanks for your inquiry. Please use the following code example to achieve your requirements. Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark("bookmark");
builder.StartBookmark("newBookmark");
builder.Write("Some text");
builder.EndBookmark("newBookmark");
builder.Writeln("");
builder.StartBookmark("newBookmark2");
builder.Write("Some text");
builder.EndBookmark("newBookmark2");
doc.Save(MyDir + "Out.docx");

Thank you very much!

Stanislav.

Hi Stanislav,

Thanks for your feedback . Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.