This project has moved and is read-only. For the latest updates, please go here.

Bookmark values not updating

Dec 13, 2014 at 2:20 AM
Hi all,
I created a bookmarks in my docx using Word 2013.

One bookmark in header, one in footer and two in the body. Then i used the following code:
            using (DocX document = DocX.Create(@"docs\BookmarkExample.docx"))
                foreach (var paragraph in document.Paragraphs)
                    var v = paragraph.GetBookmarks();
                    var bookmark = paragraph.GetBookmarks().FirstOrDefault(x => x.Name == "HeaderBM");
                    if (bookmark != null)
                        bookmark.Paragraph.InsertAtBookmark(DateTime.Now.ToShortDateString(), bookmark.Name);

When i run the code the output does not change bookmark values. In debug mode I am also noticing that paragraph collection is 0

Can someone please help!