如何读取Infopath中的重复表和重复节中的数据
若以下回答无法解决问题,邀请你更新回答
1个回答
展开全部
在一个表单中由一个重复表,有三列,分别是field1,field2,field3
有一个重复节,分别包含一个文本框——field4,一个下拉选择框,field5.
如果要读取这些重复节和重复表中的数的话,可以通过如下方式进行:
// 在此处编写代码。
XPathNodeIterator NodeIter = this.MainDataSource.CreateNavigator().Select("/my:myFields/my:group1/my:group2",this.NamespaceManager);
// NodeIter.
foreach (XPathNavigator myf in NodeIter)
{
XPathNavigator n1 = myf.SelectSingleNode("my:field1", NamespaceManager);
XPathNavigator n2 = myf.SelectSingleNode("my:field2", NamespaceManager);
XPathNavigator n3 = myf.SelectSingleNode("my:field3", NamespaceManager);
string str1 = n1.Value;
string str2 = n2.Value;
string str3 = n3.Value;
}
XPathNodeIterator NodeIter1 = this.MainDataSource.CreateNavigator().Select("/my:myFields/my:group3/my:group4",this.NamespaceManager);
// NodeIter.
foreach (XPathNavigator myf1 in NodeIter1)
{
XPathNavigator sn1 = myf1.SelectSingleNode("my:field4", NamespaceManager);
XPathNavigator sn2 = myf1.SelectSingleNode("my:field5", NamespaceManager);
// XPathNavigator sn3 = myf.SelectSingleNode("my:field3", NamespaceManager);
string strs1 = sn1.Value;
string strs2 = sn2.Value;
// string strs3 = sn3.Value;
}
有一个重复节,分别包含一个文本框——field4,一个下拉选择框,field5.
如果要读取这些重复节和重复表中的数的话,可以通过如下方式进行:
// 在此处编写代码。
XPathNodeIterator NodeIter = this.MainDataSource.CreateNavigator().Select("/my:myFields/my:group1/my:group2",this.NamespaceManager);
// NodeIter.
foreach (XPathNavigator myf in NodeIter)
{
XPathNavigator n1 = myf.SelectSingleNode("my:field1", NamespaceManager);
XPathNavigator n2 = myf.SelectSingleNode("my:field2", NamespaceManager);
XPathNavigator n3 = myf.SelectSingleNode("my:field3", NamespaceManager);
string str1 = n1.Value;
string str2 = n2.Value;
string str3 = n3.Value;
}
XPathNodeIterator NodeIter1 = this.MainDataSource.CreateNavigator().Select("/my:myFields/my:group3/my:group4",this.NamespaceManager);
// NodeIter.
foreach (XPathNavigator myf1 in NodeIter1)
{
XPathNavigator sn1 = myf1.SelectSingleNode("my:field4", NamespaceManager);
XPathNavigator sn2 = myf1.SelectSingleNode("my:field5", NamespaceManager);
// XPathNavigator sn3 = myf.SelectSingleNode("my:field3", NamespaceManager);
string strs1 = sn1.Value;
string strs2 = sn2.Value;
// string strs3 = sn3.Value;
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询