private void Spread区域绑定数据_Load(object sender, EventArgs e)
{
Stopwatch st = new Stopwatch();
st.Start();
List<dataSource> ld = GetList();
st.Stop();
string aa1 = st.Elapsed.ToString();
st.Restart();
区域绑定数据(3, 0, ld , fpSpread1);
st.Stop();
string aa2 = st.Elapsed.ToString();
st.Restart();
fpSpread1_Sheet1.AddRangeGroup(0,1,false);
fpSpread1_Sheet1.AddRangeGroup(2,1,false);
for (int i = 3; i < ld.Count;i=i+3 )
{
fpSpread1_Sheet1.AddRangeGroup(i, 2, true);
}
st.Stop();
string aa3=st.Elapsed.ToString();
st.Restart();
SuoXiao(fpSpread1);
st.Stop();
string aa4 = st.Elapsed.ToString();
MessageBox.Show("取数:"+aa1+"\n"+"绑定:"+aa2+"\n"+"大纲"+aa3+"\n"+"展开"+aa4);
}
public class dataSource
{
public string A { get; set; }
public decimal B { get; set; }
public DateTime D { get; set; }
public bool C { get; set; }
public int E { get; set; }
public double F { get; set; }
public string H { get; set; }
public decimal I { get; set; }
}
public static List<dataSource> GetList()
{
List<dataSource> ld = new List<dataSource>();
for (int i = 0; i < 10000; i++)
{
dataSource aaa = new dataSource();
aaa.A = i.ToString("001");
aaa.B = Convert.ToDecimal(i + 10 * i);
aaa.D = (new DateTime(2009, 1, 1)).AddMonths(i);
aaa.C = Convert.ToBoolean(i % 2);
aaa.E = i;
aaa.F = (i + 100 * i);
aaa.H = (i + "aaa" + i).ToString();
aaa.I = Convert.ToDecimal(i * 1000 + i * 10);
ld.Add(aaa);
}
return ld;
} |
|