问题是我无法打开任何Word模板(.dotx)。
当我单击功能区中的按钮来触发打开模板事件时,它根本没有给出任何错误或警告消息,它只是使Word冻结了几秒钟,并且没有任何返回。它不显示任何模板,只显示一个纯白色页面,就像您创建新文档时一样。
以下是我的代码,请注意,startuppath变量是尝试操纵path的结果。
string startupPath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName;
Debug.Print(startupPath);
startupPath = startupPath + "\\templateKoding\\leTemplateKoding.dotx";
Debug.Print("new path : "+startupPath);
Microsoft.Office.Interop.Word._Application word = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document doc = word.Documents.Add(@"C:\Users\futtbucker\Documents\Visual Studio 2010\Projects\Koding\Koding\templateKoding\leTemplateKoding.dotx");发布于 2014-11-17 10:29:40
使用word.Documents.Open打开
https://stackoverflow.com/questions/26689609
复制相似问题