[英]Determine if checkbox in word document is checked or not - char u0015, microsoft.office.interop.word in c#
使用 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
文本结果是:
\ 将接替员工 (wird übernommen von MA)
\ 需要订购(muss neu bestellt werden)
\ 不需要笔记本电脑/PC (braucht kein Laptop/PC)
\
是 word 文件中的小复选框。 但无论是否选中复选框,字符表示都是\
。
有什么方法可以确定是否选中了\ no need for Laptop/PC (braucht kein Laptop/PC)
的小复选框?
您可以使用 Document 类的FormFields
属性来访问控件。 然后您可以使用CheckBox属性,该属性返回一个CheckBox
对象,该对象表示复选框表单字段。
ActiveDocument.FormFields(1).CheckBox.Value = False
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.