回复 3楼ilbjyaya的帖子
可以不设置,需要设置 DataAutoCellTypes 为 false:
- private void Form1_Load(object sender, EventArgs e)
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("Bool", typeof(System.Boolean));
- dt.Columns.Add("int", typeof(System.Int32));
- dt.Rows.Add(true,1);
- dt.Rows.Add(false,0);
- dt.Rows.Add(true,1);
- this.fpSpread1.ActiveSheet.DataAutoCellTypes = false;
- this.fpSpread1.ActiveSheet.DataSource = dt;
- this.fpSpread1.ActiveSheet.Columns[0].DataField = "Bool";
- this.fpSpread1.ActiveSheet.Columns[1].DataField = "int";
- }
复制代码 |