c# - Office 2007 PIA - Embed non-text files -


i working office 2007 pias , trying generate large document x number of user selected documents. of these documents word docs, want support file type.

text documents work fine when inserted using insertfile. pictures can inserted using inlineshapes.addpicture. how embed other document types? looking functionality equivalent drag , dropping file word. if try use insertfile method, writes out binary content of non text files.

to embed non-text files in word via interop, use inlineshapes.addoleobject

i looking functionality equivalent drag , dropping file word.

this trick me:

public void insertfile(microsoft.office.interop.word.selection currentselection, string filename) { object filename = filename; object missing = type.missing; currentselection.inlineshapes.addoleobject(ref missing, ref filename, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); } 

hope helps.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -