How can I get the filename of a Word document from C#?

核能气质少年 提交于 2019-12-10 13:18:59

问题


I'm working on a MS Word AddIn (VSTO). The idea is that I work on a Word document and I send it somewhere.

I have all the code I need except one thing: is there a way I can get the filename of the Word document I'm working on? (assuming that is already saved)


回答1:


this.FullName property in the code-behind .cs file should give you the entire path of the current doc.

Here's the exact query in my QuickWatch window.

((Microsoft.Office.Tools.Word.Document)(this)).FullName


来源:https://stackoverflow.com/questions/792649/how-can-i-get-the-filename-of-a-word-document-from-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!