找回密码
 立即注册

QQ登录

只需一步,快速开始

ahljxwy

银牌会员

27

主题

67

帖子

3969

积分

银牌会员

积分
3969

活字格认证

ahljxwy
银牌会员   /  发表于:2012-4-6 09:21  /   查看:5442  /  回复:5
版主你好,我将第二列的类型设置为ComboBoxCellType,我想知道怎么获取到这列的Editable属性,当Editable为可编辑地保存text,不可编辑时保存value,谢谢!

5 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2012-4-6 10:17:00
沙发

回复 1# ahljxwy 的帖子

ahljxwy 你好,目前的方法为:
建立两个 ComboBoxCellType -> 分别设置 Editable 属性为可编辑、不可编辑 -> 遍历该列进行单元格类型判断 -> 最后保存。
回复 使用道具 举报
ahljxwy
银牌会员   /  发表于:2012-4-6 11:16:00
板凳
我现在想获取的就是这一列是否允许键盘录入,不能直接得到吗?
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-4-6 15:16:00
地板

回复 3# ahljxwy 的帖子

ahljxwy 你好,
ComboBoxCellType 单元格类型下 Editable 属性设置是否可编辑。
如果某列单元格类型为 ComboBoxCellType ,那么可以获取该列的单元格类型,判断该类型的 Editable 属性去判断该列是否可编辑。获取代码为:

  1.         private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             FarPoint.Win.Spread.CellType.ComboBoxCellType test = this.fpSpread1.Sheets[0].Columns[0].CellType as FarPoint.Win.Spread.CellType.ComboBoxCellType;
  4.             bool isEditable = test.Editable;
  5.         }

  6.         private void Form1_Load(object sender, EventArgs e)
  7.         {
  8.             FarPoint.Win.Spread.CellType.ComboBoxCellType comboboxCellType = new FarPoint.Win.Spread.CellType.ComboBoxCellType();

  9.             comboboxCellType.Editable = false;

  10.             this.fpSpread1.Sheets[0].Columns[0].CellType = comboboxCellType;
  11.         }
复制代码
回复 使用道具 举报
ahljxwy
银牌会员   /  发表于:2012-4-6 15:38:00
5#
FarPoint.Win.Spread.CellType.ComboBoxCellType test = this.fpSpread1.Sheets[0].Columns[0].CellType as FarPoint.Win.Spread.CellType.ComboBoxCellType;

这句是将某列转成ComboBoxCellType类型的了,有没有直接获取某列列类型的方法呢?谢谢!!!
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-4-6 16:18:00
6#

回复 5# ahljxwy 的帖子

Spread 另外提供 GetCellType(rowIndex,colIndex) 方法获取单元格类型:

  1. FarPoint.Win.Spread.CellType.ComboBoxCellType comboboxCellType = this.fpSpread1.Sheets[0].GetCellType(0,0)
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部