我正在使用下面的代码对我的数据进行排序,程序运行时没有任何问题,但是行中的数据没有被排序..并且找不到会出现这种情况的原因。
DataTable extractedData = new DataTable();
//data added to datatable extractedData
DataView dv = new DataView();
dv =extractedData.AsDataView();
dv.Sort = dv.Table.Columns[10].ColumnName + " DESC";
extractedData = dv.Table;
下面的apose.slides
代码用于将代码添加到演示表中。
string val = "";
int col = 0;
int row = 0;
for (int i = 1; i < table.Rows.Count; i++)
{
for (int j = 0; j < table.Columns.Count; j++)
{
if (j == 0)
{
val = extractedData.Rows[row][valuesUsed[col]].ToString();
string[] removeQuestion = val.Split('[', ']');
val = removeQuestion[1];
}
else
{
val = extractedData.Rows[row][valuesUsed[col]].ToString();
if (val == "-" || val == "")
{
val = extractedData.Rows[row][valuesUsed[col]].ToString();
}
else
{
val = Convert.ToString(Math.Round(Convert.ToDouble(extractedData.Rows[row][valuesUsed[col]]), MidpointRounding.AwayFromZero));
}
}
table[j, i].TextFrame.Text = val;
col++;
}
row++;
col = 0;
}