有关 给word控件赋值的问题 速进 在线等~~~

qydvip 2015-06-18 01:02:55
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; //这里应该如何写, 这么写是不对的
}
}




...全文
236 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
qydvip 2015-06-18
  • 打赏
  • 举报
回复
引用 3 楼 Z65443344 的回复:
不懂帮顶 word里有checkbox这种东西?
用的
於黾 2015-06-18
  • 打赏
  • 举报
回复
不懂帮顶 word里有checkbox这种东西?
qydvip 2015-06-18
  • 打赏
  • 举报
回复
怎么没有人啊 是问题太简单了?
qydvip 2015-06-18
  • 打赏
  • 举报
回复
坐等 大神 们。。。。。。。。。。。。

111,096

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧