【发布时间】:2015-08-14 20:29:39
【问题描述】:
我有一个 Word 模板 (*.dotx) 我正在尝试使用 C# 填充。
我无法访问模板中的“纯文本内容控件”。
以下代码添加(打开)文档,但始终显示 0 个表单域。
参考文献:
using Application = Microsoft.Office.Interop.Word.Application;
using Document = Microsoft.Office.Interop.Word.Document;
功能代码:
var word = new Application();
var doc = new Document();
doc = word.Documents.Add(Directory.GetCurrentDirectory() +
@"\..\..\Media\Documents\MCO Notification of a Medicaid Other Event - Template.dotx");
doc.Activate();
MessageBox.Show(doc.FormFields.Count.ToString());
doc.Close();
word.Quit();
另外,如何在应用程序中插入文档的相对路径。
【问题讨论】: