c# - Microsoft.Office.Interop.Word Selection.InsertFile() Method->How to use Bookmark in Range Parameter -
we're doing update ms word add-in allows users insert ms word files central ms word document using following function:
//created rng variable microsoft.office.interop.word.range rng = globals.thisaddin.application.selection.range; //ms interop method. globals.thisaddin.application.selection.insertfile( filename, rng,//<--added range ref missing, //confirm conversions ref falsevalue, //link file ref falsevalue //attachment );
the second parameter:
ref missing, //range - word can bookmark
seems can pass range parameter can bookmark (which can use delete added content, if needed), haven't been able find implementation examples demonstrate how done.
msdn describes parameter follows:
range
type: system.object
optional object.
if specified file word document, parameter refers bookmark. if file type (for example, microsoft excel worksheet), parameter refers named range or cell range (for example, r1c1:r3c4).
since want insert new bookmark text, assumed need to:
- create new bookmark, ,
- pass insertfile parameter list
however @ point, since can't find examples of how achieved, we're @ stopping point.
we found examples such these:
http://www.c-sharpcorner.com/article/add-replace-and-remove-bookmarks-in-word-using-c-sharp/
but doesn't implementations using word interop or selection.insertfile().
intellisense doesn't seem indicate range property on microsoft.office.interop.word.bookmark:
thanks.
bookmarks (your fist link) collection of bookmark objects. bookmark has range property. use that.
Comments
Post a Comment