日期:2014-05-20  浏览次数:20959 次

求助一级窗体调用二级窗体以行调用和以单元格
请教下怎么添加内容让一级窗体调用二级窗体时,以行调用和以单元格调用两种方式可自由定制
外部我改不了,只能在这里添加
private string getstatements(StringToxml _StringToxml, DataTable _DataTable)
  {
  string Align = getvalue("Align");
  string xmlstring = "<UnitAttributes>";
  XmlNodeList list = _StringToxml.getNodes("datasets");
  if (list.Count > 0)
  {
  foreach (XmlNode item in list)
  {
  xmlstring += "<UnitAttribute Header='" + item.Attributes["caption"].Value + "' Width='100' Align='" + Align + "' Types='ed' Sorting='str'></UnitAttribute>";
  for (int i = 0; i < item.ChildNodes.Count - 1; i++)
  {
  xmlstring += "<UnitAttribute Header='#cspan' Width='50' Align='" + Align + "' Types='ed' Sorting='str'></UnitAttribute>";
  }
  }
  xmlstring += "<afterInit><call command='attachHeader'><param>";

  foreach (XmlNode item in list)
  {
  for (int i = 0; i < item.ChildNodes.Count; i++)
  {
  if (item.ChildNodes.Count == 1)
  {
  xmlstring += "#rspan";
  }
  else
  {
  xmlstring += item.ChildNodes[i].Attributes["value"].Value;

  } xmlstring += ",";
  }
  }
  xmlstring += " </param></call></afterInit>";
  xmlstring += "</UnitAttributes><rows>";
  list = _StringToxml.getNodes("dataset");
  for (int i = A; i < B; i++)
  {
  xmlstring += " <row id='" + i + "'>";
  foreach (XmlNode item in list)
  {
  xmlstring += "<cell>" + _DataTable.Rows[i][item.Attributes["name"].Value].ToString() + "</cell>";
  }
  xmlstring += " </row>";
  }
  return xmlstring + "</rows>";
  }
  else
  {
  XmlNodeList FieldNames = _StringToxml.getNodes("FieldName");
  if (FieldNames.Count > 0)
  {
  for (int j = 0; j < FieldNames.Count; j++)
  {
  if (j == FieldNames.Count - 1)
  {
  xmlstring += "<UnitAttribute Header='" + FieldNames[j].Attributes["value"].Value + "' Width='*' Align='" + Align + "' Types='ed' Sorting='str'></UnitAttribute>";
  }
  else
  {
  xmlstring += "<UnitAttribute Header='" + FieldNames[j].Attributes["value"].Value + "' Width='" + FieldNames[j].Attributes["value"].Value.Length * 30 + "' Align='" + Align + "' Types='ed' Sorting='str'></UnitAttribute>";