回复 2楼liu3210519的帖子
liu3210519 你好,
请问你使用的是 WinForms 平台 Spread 控件吧?
你可以通过以下代码获取当前输入的文本,这样就获取了全角和半角文本,再通过设置当前单元格 Editor 的Text属性进行截取字符串:
- private void Form1_Load(object sender, EventArgs e)
- {
- this.fpSpread1.EditModeOn += fpSpread1_EditModeOn;
- }
- void fpSpread1_EditModeOn(object sender, EventArgs e)
- {
- GeneralEditor ge = this.fpSpread1.EditingControl as GeneralEditor;
- ge.TextChanged += ge_TextChanged;
- }
- void ge_TextChanged(object sender, EventArgs e)
- {
- GeneralEditor ge = sender as GeneralEditor;
- Debug.WriteLine(ge.Text);
- }
复制代码
如果仍然有问题,欢迎继续交流 |