I've not had any luck in either the OpenXML API or Word/VSTO API, finding a way to create or modify a bookmark's visibility. Even adding bookmarks manually in Word, there's no box to check to make the bookmark hidden. Although there is a checkbox in the Bookmarks dialog that lets you show hidden bookmarks. So how are hidden bookmarks represented in the XML, and can you create them using the Open XML SDK? Or are they a legacy thing that MS no longer wants us to create?
OK so this is easier than I thought...you just precede the bookmark name with an underscore. Note that this can only be done programmatically, not when adding bookmarks manually in Word.
Iiiiiiiiinteresting....
Update: Another thing I found--before you can iterate or access hidden bookmarks in a Bookmarks object, you must set its ShowHidden property to true.
PS - SO, if you have any control over your spelling dictionary, you might add "programmatically". Unless I'm spelling it wrong. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With