我使用以下代码之后可以正常操作,你可以试一下:
- private void Form2_Load(object sender, EventArgs e)
- {
- fpSpread1.ActiveSheet.Protect = false;
- fpSpread1.ActiveSheet.ColumnHeader.SetClip(0, 0, 1, 5, "AAA\tBBB\tCCC\tDDD\tEEE");
- CheckBoxCellType cbc = new CheckBoxCellType();
- fpSpread1.ActiveSheet.Columns[0].CellType = cbc;
- }
- private void btnSave_Click(object sender, EventArgs e)
- {
- fpSpread1.SaveExcel(@"aaa.xls", FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders);
- }
- private void btnOpen_Click(object sender, EventArgs e)
- {
- fpSpread1.OpenExcel(@"aaa.xls", FarPoint.Excel.ExcelOpenFlags.RowAndColumnHeaders);
- FarPoint.Win.Spread.CellType.CheckBoxCellType checkType = new FarPoint.Win.Spread.CellType.CheckBoxCellType();
- fpSpread1_Sheet1.Columns[0].CellType = checkType;
- fpSpread1.ActiveSheet.Protect = false;
- }
复制代码 |