你好,可以在绑定数据之后添加列和非绑定行,去实现区域绑定效果,做法如下
- FarPoint.Web.Spread.Model.DefaultSheetDataModel dataModel = new FarPoint.Web.Spread.Model.DefaultSheetDataModel();
- DataTable name = new DataTable();
- name.Columns.Add("FirstName", Type.GetType("System.String"));
- name.Columns.Add("LastName", Type.GetType("System.String"));
- name.Rows.Add("John", "Doe");
- name.Rows.Add("Sally ", "Jones");
- name.Rows.Add("Terry", "Hernandez");
- FpSpread1.ActiveSheetView.DataModel = dataModel;
- dataModel.DataSource = name;
- dataModel.AddUnboundRows(0, 2);
- FpSpread1.ActiveSheetView.AddColumns(0, 3);
复制代码 效果图:
png
|