SamirW 发表于 2017-2-15 14:21:20

怎么用代码 选择一个表格的多个行 或者多个列 进行合并

WPF 怎么用代码 选择一个表格的多个行或者多个列 进行合并

gw0506 发表于 2017-2-15 15:27:03

你查一下文档,看一下Table类型下面的Select和MergeCells方法就清楚了。

SamirW 发表于 2017-2-15 15:46:43

gw0506 发表于 2017-2-15 15:27
你查一下文档,看一下Table类型下面的Select和MergeCells方法就清楚了。

我知道那两个方法,那怎么用代码选中一个5行5列的表格的 第一列的前两行进行合并

gw0506 发表于 2017-2-15 16:16:21

接口你也知道,我不知道你在写的时候哪里有困难?

SamirW 发表于 2017-2-15 16:25:34

gw0506 发表于 2017-2-15 16:16
接口你也知道,我不知道你在写的时候哪里有困难?

我说的问题也很清楚吧一个5行5列的表格 我想要 第一列的前两行 进行 选中,怎么用代码进行选中,我知道 只要选中就可以用MergeCells进行合并,关键是如何选中。 目前我找到的只有选中整个Table或者 选中一个Cell 或者 整行 或者 整列。而没找到选中整行整列的的Cell的方法。。
这下 问题应该清楚了吧

SamirW 发表于 2017-2-15 16:27:58

上面倒数第二句打错了 应该是 而没找到选中非整行整列的多个Cell的方法

SamirW 发表于 2017-2-15 16:31:41

当然 表格中横向选中 或许可以通过 cell的Start进行组合确定选中长度 赋值给 TextControl的Selection。 纵向的多Cell选中我就不会了

gw0506 发表于 2017-2-15 18:01:04

Select有4个参数,用这4个参数选择一个范围。纵向多Cell就是startcol和endcol一样,startrow和endrow分别是第几行到底几行。给参数就可以了。

Select(Int32, Int32, Int32, Int32)
Selects the part of the table defined through two table cells.


public void Select(int startRow, int startColumn, int stopRow, int stopColumn);

Public Sub Select(ByVal startRow As Integer, ByVal startColumn As Integer, ByVal stopRow As Integer, ByVal stopColumn As Integer)
MemberDescription
startRowSpecifies the row number where the selection begins.

startColumnSpecifies the column number where the selection begins.

stopRowSpecifies the row number where the selection ends.

stopColumnSpecifies the column number where the selection ends.

SamirW 发表于 2017-2-15 19:22:52

gw0506 发表于 2017-2-15 18:01
Select有4个参数,用这4个参数选择一个范围。纵向多Cell就是startcol和endcol一样,startrow和endrow分别是 ...

感谢感谢 解决

gw0506 发表于 2017-2-16 09:17:59

不用客气~
页: [1] 2
查看完整版本: 怎么用代码 选择一个表格的多个行 或者多个列 进行合并