MergeCells 如何使用?
MergeCells 要如何使用?我查看table的CanMergeCells属性,为false,什么情况下变为true?我有一个table,5列,想把后4列合并,怎么操作?
我的代码:TableCell cell2 = table.Cells.GetItem(1, 2);
TableCell cell3 = table.Cells.GetItem(1, 3);
TableCell cell4 = table.Cells.GetItem(1, 4);
TableCell cell5 = table.Cells.GetItem(1, 5);
textControl.Selection.Start = cell2.Start - 1;
textControl.Selection.Length = cell2.Length + cell3.Length + cell4.Length + cell5.Length;
bool b = table.MergeCells();//为false
textControl.Selection.Length = 0;
回复 1# forachange 的帖子
forachange 你好,请使用以下代码测试:
private void Form1_Load(object sender, EventArgs e)
{
this.textControl1.Tables.Add(10, 5, 11);
}
private void mergeCellsToolStripMenuItem_Click(object sender, EventArgs e)
{
TXTextControl.Table table = this.textControl1.Tables.GetItem(11);
textControl1.Selection.Start = 0;
textControl1.Selection.Length = 12;
table.MergeCells();
}
这样合并的是前面两列。
http://www.tu265.com/di-82080157dfe9be550ac42066daed60b0.jpg
如何合并后面的几列呢?我发现我取的Length都是0
cell2.Length + cell3.Length + cell4.Length + cell5.Length
所以设置textControl.Selection.Length时为0 谢谢iceman。
想编辑一下上面的贴子,说发帖失败,内容中似乎有广告信息,请检查标题和内容,如有疑问请与管理员联系。晕
回复 4# forachange 的帖子
forachange 你好该问题正在调查中,稍后回复~ 还在等待版主的信呢~ 呼叫版主~
回复 7# forachange 的帖子
forachange 你好,经调查,通过代码合并单元格存在缺陷,无法使用代码合并后四列,建议通过 UI 操作。 :L !!!~~ 谢谢iceman。
页:
[1]
2