連接到數據源Word文檔我有一個在指定的位置在Word中打開一個文檔的功能:打開包含合併域和C#
static void OpenWordDocument(string fileName)
{
Type applicationType = Type.GetTypeFromProgID("Word.Application");
object applicationObject = Activator.CreateInstance(applicationType);
object documentsObject = applicationType.InvokeMember("Documents", System.Reflection.BindingFlags.GetProperty, null, applicationObject, null);
applicationType.InvokeMember("Visible", System.Reflection.BindingFlags.SetProperty, null, applicationObject, new object[] { true });
Type documentsType = documentsObject.GetType();
object documentObject = documentsType.InvokeMember("Open", System.Reflection.BindingFlags.InvokeMethod, null, documentsObject, new Object[] { fileName });
}
它正常工作與Office 2003,但在打開時該文檔在使用Office 2010的系統上,文檔似乎無法連接到數據源。 這可能是什麼原因造成的?當我打開可能阻塞連接的文檔時,是否缺少任何屬性?
正確的條目我會進行調查。謝謝(你的)信息 – mechaman64