Hi,
To create Bookmarks in word document and earlier i recieved a code, but unable to understand and run the code.
Earlier Code Recieved
Aspose.Words.Document doc = new Aspose.Words.Document(@“D:\CCDS DOCS\Required Documents/SourceDocument.docx”);
// Aspose.Words.Document doc = new Aspose.Words.Document(MyDir + @“Source+Document.docx”);
// @“D:\Sreedhar\10 September 2014\pdftohtml\Data/codeine ccds.html”
DocumentBuilder builder = new DocumentBuilder(doc);
BookmarkStart bm1 = builder.StartBookmark(“Bookmark1”);
builder.EndBookmark(“Bookmark1”);
BookmarkStart bm2 = builder.StartBookmark(“Bookmark2”);
builder.EndBookmark(“Bookmark2”);
BookmarkStart bm3 = builder.StartBookmark(“Bookmark3”);
builder.EndBookmark(“Bookmark3”);
//Place Bookmark1 start and end nodes at target places in DOM
Run run = doc.FirstSection.Body.Paragraphs[1].Runs[0];
run.ParentNode.InsertAfter(bm1, run); //Error here
run = doc.FirstSection.Body.Paragraphs[5].Runs[0];
run.ParentNode.InsertBefore(bm1.Bookmark.BookmarkEnd, run);
//Place Bookmark2 start and end nodes at target places in DOM
run = doc.FirstSection.Body.Paragraphs[6].Runs[0];
run.ParentNode.InsertBefore(bm2, run);
doc.FirstSection.Body.Paragraphs[13].AppendChild(bm2.Bookmark.BookmarkEnd);
//Place Bookmark3 start and end nodes at target places in DOM
//run = doc.FirstSection.Body.Paragraphs[14].Runs[0];
//run.ParentNode.InsertBefore(bm3, run);
doc.FirstSection.Body.Paragraphs[17].AppendChild(bm3.Bookmark.BookmarkEnd);
doc.Save(@“E:\CCDS Docs\Required Documents/putDocument.docx”);
Sending again source document as an attachment to this mail
Thanks
Naveen