计算最小值
string j = dt.Columns[i].ColumnName.ToString().Trim();
excel.Cells[dataGridView1.Rows.Count + 11, i - 1] = dt.Compute("Min(" + j + ")", "true"); //最小值
DataTable dt;
DataTable dt2 = dt.Clone(); //导入数据结构,无内容
string i = dt.Columns[i].ColumnName.ToString().Trim();
dt2.Columns[i].DataType = typeof(Decimal); //设定格式,将字符串转换为数字
foreach (DataRow dr in dt.Rows)
{
dt2.ImportRow(dr); //导入数据
}
excel.Cells[dataGridView1.Rows.Count + 10, i - 1] = dt2.Compute("avg(" + i + ")", "true");