请教:
调用方法后,子层数据如何显示?
public static void 区域绑定数据(int rowStar, int cluStar, List<dataSource> 数据源, FpSpread fpSpread1)
{
FarPoint.Win.Spread.Data.SpreadDataBindingAdapter data = new FarPoint.Win.Spread.Data.SpreadDataBindingAdapter();
data.DataSource = 数据源;
int i = 数据源.Count*6;
int j = typeof(dataSource).GetProperties().Count()+typeof(dataSource.Gg).GetProperties().Count()-1;
data.Spread = fpSpread1;
data.SheetName = "Sheet1";
data.MapperInfo = new FarPoint.Win.Spread.Data.MapperInfo(rowStar, cluStar,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 List<Gg> gg { get; set; }
public class Gg
{
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 < 10; 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);
List<dataSource.Gg> kk = new List<dataSource.Gg>();
for (int j = i; j < i+5;j++ )
{
dataSource.Gg bbb = new dataSource.Gg();
bbb.C = Convert.ToBoolean(i % 2);
bbb.E = i;
bbb.F = (i + 100 * i);
bbb.H = (i + "aaa" + i).ToString();
bbb.I = Convert.ToDecimal(i * 1000 + i * 10);
kk.Add(bbb);
}
aaa.gg=kk;
ld.Add(aaa);
}
return ld;
} |
|