Hello,
I'm trying to checking checkbox inside a word document using bookmark to get to the checkbox.
Only checkbox form field (legacy) are recognized, but i could got them with bookmark. I change the checked status and save. Opening the word, checkbox are unchecked. I can change text and add image using bookmark, but for checkbox i don't find how to do it.
In fact, i can have checked box if i delete the bookmark content and add a new checkbox, but i'm also loosing formatting.
My code :
internal void Checkbox(BookmarksNavigator bookmarkNavigator, string BookName)
{
bookmarkNavigator.MoveToBookmark(BookName);
TextBodyPart part = bookmarkNavigator.GetBookmarkContent();
var body = part.BodyItems[0] as WParagraph;
var item = body.ChildEntities.FirstItem;
var check = item as WCheckBox;
check.Checked = true;
//// I tried theses command too
//check.CalculateOnExit = true;
//check.Update();
}
After i save the stream and open the doc.
Thank this indeed working !
Although, it's erase content after the checkbox.
In this lighty modified word document, content after checkbox are erased, even other checkbox with another bookmark.
It's working perfectly.
Thank you for your excellent support.