给不同单元格使用不同的Items就可以:
- private void Form1_Load(object sender, EventArgs e)
- {
- Dictionary<string, string> items;
- MyCellType ctp = new MyCellType();
- items = new Dictionary<string, string>();
- items.Add("0", "不合格");
- items.Add("1", "合格");
- ctp.Items = items;
- fpSpread1.ActiveSheet.Columns[0].CellType = ctp;
- fpSpread1.ActiveSheet.Cells[0, 0].Value = 0;
- fpSpread1.ActiveSheet.Cells[1, 0].Value = 1;
- MyCellType ctp2 = new MyCellType();
- items = new Dictionary<string, string>();
- items.Add("1", "符合要求");
- items.Add("0", "不符合要求");
- ctp2.Items = items;
- fpSpread1.ActiveSheet.Columns[1].CellType = ctp2;
- fpSpread1.ActiveSheet.Cells[0, 1].Value = 0;
- fpSpread1.ActiveSheet.Cells[1, 1].Value = 1;
- MyCellType ctp3 = new MyCellType();
- items = new Dictionary<string, string>();
- items.Add("1", "通");
- items.Add("0", "断");
- ctp3.Items = items;
- fpSpread1.ActiveSheet.Columns[2].CellType = ctp3;
- fpSpread1.ActiveSheet.Cells[0, 2].Value = 0;
- fpSpread1.ActiveSheet.Cells[1, 2].Value = 1;
- }
复制代码
|