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:

  1. create new bookmark, ,
  2. pass insertfile parameter list

however @ point, since can't find examples of how achieved, we're @ stopping point.

we found examples such these:

https://msdn.microsoft.com/en-us/library/microsoft.office.tools.word.bookmark.bookmarks(v=vs.120).aspx

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:

enter image description here

thanks.

bookmarks (your fist link) collection of bookmark objects. bookmark has range property. use that.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -