如何从C#获取Word文档的文件名? [英] How can I get the filename of a Word document from C#?

查看:257
本文介绍了如何从C#获取Word文档的文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究MS Word插件(VSTO). 这个想法是我处理Word文档,然后将其发送到某个地方.

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

除了一件事情外,我拥有所有需要的代码:有没有办法获取我正在处理的Word文档的文件名? (假设已保存)

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)

推荐答案

this.FullName 属性应为您提供当前文档的完整路径.

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

这篇关于如何从C#获取Word文档的文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆