如何读取Infopath中的重复表和重复节中的数据
在一个表单中由一个重复表,有三列,分别是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;
}