spread 表格在数据绑定的时候怎样不改变a,b,c,d的例头名进行数据绑定
【页面效果】
【后台代码】
Page_Load方法里面的代码如下
protected void btnQuery_Click(object sender, EventArgs e)
{
//var dt = GetDataTable();
var dt = Model.ProjectBudget.GetData();
//关闭自动生成列属性
this.FpSpread1.Sheets.AutoGenerateColumns = false;
//绑定数据源
this.FpSpread1.DataSource = dt;
this.FpSpread1.Sheets.Columns.DataField = "A";
this.FpSpread1.Sheets.Columns.DataField = "项目";
this.FpSpread1.Sheets.Columns.DataField = "所属部门";
this.FpSpread1.Sheets.Columns.DataField = "预算事项编码";
this.FpSpread1.Sheets.Columns.DataField = "预算事项名称";
this.FpSpread1.Sheets.Columns.DataField = "预算科目代码";
this.FpSpread1.Sheets.Columns.DataField = "预算科目名称";
this.FpSpread1.Sheets.Columns.DataField = "年度";
this.FpSpread1.Sheets.Columns.DataField = "1月";
this.FpSpread1.Sheets.Columns.DataField = "2月";
this.FpSpread1.Sheets.Columns.DataField = "3月";
this.FpSpread1.Sheets.Columns.DataField = "4月";
this.FpSpread1.Sheets.Columns.DataField = "5月";
this.FpSpread1.Sheets.Columns.DataField = "6月";
this.FpSpread1.Sheets.Columns.DataField = "7月";
this.FpSpread1.Sheets.Columns.DataField = "8月";
this.FpSpread1.Sheets.Columns.DataField = "9月";
this.FpSpread1.Sheets.Columns.DataField = "10月";
this.FpSpread1.Sheets.Columns.DataField = "11月";
this.FpSpread1.Sheets.Columns.DataField = "12月";
foreach (SheetView sheet in this.FpSpread1.Sheets)
{
sheet.AllowPage = false;
}
this.FpSpread1.Sheets.RowCount = 100;
this.FpSpread1.Sheets.ColumnCount = 100;
} 回复 1楼wangwuliSpread的帖子
问题已经通过电话沟通,如果需要绑定后列头依然是 A、B、C、D 形式,那么可以通过调整 SQL 语句来做。
例如:
select field as A from tablename
页:
[1]