Hi,
Adding the bookmark mark text in a cell level document header makes the bookmark disappear when rendering using the following code
> private bool InternalWriteToBookMark(Document AWordDoc, string _bookName, string _bookText)
{ LogInfo("DocumentConversion.InternalWriteToBookMark - Start - Bookmark Name: " + _bookName + " Bookmark Text: " + _bookText); bool ModifiedBookmark = false; ProtectionType oldProtectionType = AWordDoc.ProtectionType; if (oldProtectionType != ProtectionType.NoProtection) { LogInfo("DocumentConversion.InternalWriteToBookMark - Before: wordDoc.Unprotect()"); AWordDoc.Unprotect(); LogInfo("DocumentConversion.InternalWriteToBookMark - After: wordDoc.Unprotect()"); } try { LogInfo("DocumentConversion.InternalWriteToBookMark - Before: AWordDoc.Range.Bookmarks"); Bookmark bookmark = AWordDoc.Range.Bookmarks[_bookName]; LogInfo("DocumentConversion.InternalWriteToBookMark - After: AWordDoc.Range.Bookmarks"); if (bookmark == null) { LogInfo("DocumentConversion.InternalWriteToBookMark - Bookmark " + _bookName + " does not exist in document"); } else { LogInfo("DocumentConversion.InternalWriteToBookMark - Bookmark " + _bookName + " exists in document"); LogInfo("DocumentConversion.InternalWriteToBookMark - modifying text within bookmark - this will always overwrite"); bookmark.Text = _bookText; LogInfo("DocumentConversion.InternalWristeToBookMark - Found and inserted text within Bookmark: " + _bookName); ModifiedBookmark = true; } } finally { if (oldProtectionType != ProtectionType.NoProtection) { LogInfo("DocumentConversion.InternalWriteToBookMark - Before wordDoc.Protect(oldProtectionType);"); AWordDoc.Protect(oldProtectionType, null); } } LogInfo("DocumentConversion.InternalWriteToBookMark - End - Bookmark Name: " + _bookName + " Bookmark Text: " + _bookText); return ModifiedBookmark; }
Please Add support for ColumnFirst and ColumnLast properties in BookmarkStart as these will be filled out for cell level bookmarks.
Please find the attachment of the word template that is used to reproduce the bug. (filling the Date of Birth field in the header causes the bug)
Thanks,
RobertTestBookMarkTemplate.zip (37.4 KB)