问题描述
必备信息
有一个包含以下单元格的 word 文档:
使用 Microsoft.Office.Interop.Word 像这样访问单元格文本:
Document doc = ap.Documents.Open(path,ReadOnly: true,Visible: false);
Table docTable = doc.Tables[1];
string field = table.Rows[12].Cells[2].Range.Text
文本结果为:
\u0015 将接替员工 (wird übernommen von MA)
\u0015 需要订购(muss neu bestellt werden)
\u0015 不需要笔记本电脑/PC (braucht kein Laptop/PC)
问题
\u0015
是 word 文件中的小复选框。但无论是否选中复选框,字符表示都是\u0015
。
问题
有没有办法确定 \u0015 no need for Laptop/PC (braucht kein Laptop/PC)
中的小复选框是否被选中?
解决方法
您可以使用 Document 类的 FormFields
属性来访问控件。然后您可以使用 CheckBox 属性返回一个 CheckBox
对象,该对象代表一个复选框表单域。
ActiveDocument.FormFields(1).CheckBox.Value = False