This project has moved. For the latest updates, please go here.
1
Vote

Novacode docx bookmarks does not render

description

I am using Novacode docx to read bookmarks and replace them with my data. Looking at my docx file, I have a bookmark called 'UserID' and I try and replace it in my c# code as below

using (DocX doc = DocX.Load(oTemplate))
{
doc.Bookmarks["UserID"].SetText("MyUser");
}

The error I get is "sequence contains more than one element" When I look in the debugger the object of doc, there are actually two bookmarks with the name 'UserID' but in word there is only one. I am using word 2016. Anybody has any ideas what the problem could be?

comments