有关 给word控件赋值的问题 速进 在线等~~~
word模板中 有很多 checkbox 控件 我需要用数据源来判断 勾选操作
我的想法是 获取checkbox 组 然后 循环里边的checkbox
groupName,name,value 的值我都取出来了
问题来了 如何把value的值改变呢 ?
Object filename = Pathq;
Object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Application wordapp = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document doc = new Document();
doc = wordapp.Documents.Open(ref filename, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);
foreach (InlineShape shape in doc.InlineShapes)
{
string groupName = shape.OLEFormat.Object.GetType().InvokeMember("GroupName", System.Reflection.BindingFlags.GetProperty, null, shape.OLEFormat.Object, null).ToString();
string name = shape.OLEFormat.Object.GetType().InvokeMember("Name", System.Reflection.BindingFlags.GetProperty, null, shape.OLEFormat.Object, null).ToString();
string value = shape.OLEFormat.Object.GetType().InvokeMember("Value", System.Reflection.BindingFlags.GetProperty, null, shape.OLEFormat.Object,null).ToString();
if(name=="checkbox1")
{
value=true; //这里应该如何写, 这么写是不对的
}
}