你试一下下面的代码,LabelEditor也有一个Text属性,这个Text属性的优先级要比Cell上的Text的优先级高。
1. 如果LabelEditor.Text为null, Cell的Text属性才能显示出来。
2. 如果LabelEditor.Text不为null, Cell的Text不会被显示出来,我们只使用labelEditor的Text,即便它是string.Empty.
你可以按照我的注释修改第二句代码来试,所以你的问题应该是,LabelEditor.Text被设置为String.Empty了,所以显示不出来,把它设置为Null就可以了。
- private void button1_Click_1(object sender, EventArgs e)
- {
- LabelEditor lableEditor = (LabelEditor)this.multiRowSheet2[0, 0, 0].Editor;
- lableEditor.Text = "bbb"; //或者改为Null,或者改为String.Empty
- this.multiRowSheet2[0, 0, 0].Editor = lableEditor;
- this.multiRowSheet2[0, 0, 0].Text = "aaa";
- }
复制代码 |