Fixed FlexGrid glitch that was causing the Column Count to be missing. The code has been changed so that the glitch will not cause a failure.

This commit is contained in:
Rich 2013-12-19 22:29:02 +00:00
parent 8f6fae12af
commit 08b0b27c64

View File

@ -146,8 +146,8 @@ namespace Volian.Controls.Library
{
string defCW = xd.SelectSingleNode("C1FlexGrid/ColumnInfo/DefaultSize").InnerText;
string defRH = xd.SelectSingleNode("C1FlexGrid/RowInfo/DefaultSize").InnerText;
int cols = int.Parse(xd.SelectSingleNode("C1FlexGrid/ColumnInfo/Count").InnerText);
int rows = int.Parse(xd.SelectSingleNode("C1FlexGrid/RowInfo/Count").InnerText);
int cols = ColumnCount(xd);
int rows = RowCount(xd);
List<string> rh = new List<string>();
for (int i = 0; i < rows; i++)
rh.Add(defRH);
@ -182,10 +182,36 @@ namespace Volian.Controls.Library
}
return rhcw;
}
private int ColumnCount(XmlDocument xd)
{
XmlNode xn = xd.SelectSingleNode("C1FlexGrid/ColumnInfo/Count");
int cols = 0;
if (xn != null)
cols = int.Parse(xn.InnerText);
else
{
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Columns/Column");
cols = nl.Count;
}
return cols;
}
private int RowCount(XmlDocument xd)
{
XmlNode xn = xd.SelectSingleNode("C1FlexGrid/RowInfo/Count");
int rows = 0;
if (xn != null)
rows = int.Parse(xn.InnerText);
else
{
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Rows/Row");
rows = nl.Count;
}
return rows;
}
private string GetCellDataString(XmlDocument xd)
{
int cols = int.Parse(xd.SelectSingleNode("C1FlexGrid/ColumnInfo/Count").InnerText);
int rows = int.Parse(xd.SelectSingleNode("C1FlexGrid/RowInfo/Count").InnerText);
int cols = ColumnCount(xd);
int rows = RowCount(xd);
List<string> datum = new List<string>();
for (int i = 0; i < rows * cols; i++)
datum.Add("|");
@ -208,8 +234,8 @@ namespace Volian.Controls.Library
}
private string GetCellFormatString(XmlDocument xd)
{
int cols = int.Parse(xd.SelectSingleNode("C1FlexGrid/ColumnInfo/Count").InnerText);
int rows = int.Parse(xd.SelectSingleNode("C1FlexGrid/RowInfo/Count").InnerText);
int cols = ColumnCount(xd);
int rows = RowCount(xd);
List<string> datum = new List<string>();
for (int i = 0; i < rows * cols; i++)
datum.Add("|");