public static void 区域绑定数据(int 行起始位置, int 列起始位置, List<dataSource> 数据源, FpSpread fpSpread1)
{
FarPoint.Win.Spread.Data.SpreadDataBindingAdapter data = new FarPoint.Win.Spread.Data.SpreadDataBindingAdapter();
data.DataSource = 数据源;
int i = 数据源.Count;
int j = typeof(dataSource).GetProperties().Count();
data.Spread = fpSpread1;
data.SheetName = "Sheet1";
data.MapperInfo = new FarPoint.Win.Spread.Data.MapperInfo(行起始位置, i - 1, 列起始位置, j - 1);
data.FillSpreadDataByDataSource();
}
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 < 20; i++)
{
dataSource aaa = new dataSource();
aaa.A = i.ToString("001");
aaa.B = Convert.ToDecimal(i + 10 * i);
aaa.C = Convert.ToBoolean(i % 2);
aaa.D = (new DateTime(2009, 1, 1)).AddMonths(i);
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;
} |
|