【发布时间】:2019-05-20 00:28:00
【问题描述】:
我正在尝试使用 OpendFileDialog 来获取要传递给 word 应用程序实例的路径。到目前为止,这是我的代码。它告诉我'对不起,我们找不到你的文件。它被移动、重命名或删除了吗?
这是我的代码。谢谢。
OpenFileDialog OpenFileDialog1 = new OpenFileDialog();
private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog1.Filter = @"All Files|*.*";
if (openFile.ShowDialog() == DialogResult.OK)
{
string filePath = System.IO.Path.GetFullPath(OpenFileDialog1.FileName);
}
Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document wordDoc = null;
object fileName = "filePath";
object missing = System.Type.Missing;
document = App.Documents.Open(ref fileName, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing);
【问题讨论】:
标签: c# openfiledialog