private XmlDocument createFlexGridXmlDoc(string[] colheaders, string[] rowheaders, string[,] data)
{
XmlDocument xd = new XmlDocument();
int rc = rowheaders.Length;
int cc = colheaders.Length;
string colnames = "<table cellpadding=\"5\" cellspacing=\"0\"><thead><tr><th class=\"h\"></th>";
foreach (string s in colheaders)
{
//11Jul2014added to avoid crash when colnames are not there. There must be something.
if (s == null || s.Trim().Length < 1)
colnames = colnames + "<th class=\"c\">" + ".-." + "</th>";//".-.'" is spl char sequence that tells that there is no header
else
colnames = colnames + "<th class=\"c\">" + s + "</th>";
}
colnames = colnames + "</tr></thead>";
//// creating row headers with data ie.. one complete row ////
string rowdata = "<tbody>";
for (int r = 0; r < rc; r++)
{
//Putting Row Header in a row. ".-.'" is spl char sequence that tells that there is no header
if (bsky_no_row_header)
{
rowdata = rowdata + "<tr><td class=\"h\">" + ".-." + "</td>";//rowheader in row
}
else
{
rowdata = rowdata + "<tr><td class=\"h\">" + rowheaders[r] + "</td>";//rowheader in row
}
//Putting Data in a row
for (int c = 0; c < cc; c++)/// data in row
{
rowdata = rowdata + "<td class=\"c\">" + data[r, c].Replace("<", "<").Replace(">", ">") + "</td>";
}
rowdata = rowdata + "</tr>";
}
rowdata = rowdata + "</tbody></table>";
string fullxml = colnames + rowdata;
xd.LoadXml(fullxml);
return xd;
}