# [Gambas-user] Merge cells or split cells In GridView or TableView

Mon Jul 26 02:09:21 CEST 2021

```On Mon, 2021-07-26 at 00:28 +0100, Bruce Steers wrote:
>
>
> On Mon, 26 Jul 2021 at 00:15, Mayost Sharon <sharon at 455.co.il> wrote:
> > Hello
> >
> > Is it possible to merge cells or split cells
> > In controls: GridView or TableView
> >
> > Thank you
>
> no automatic function, you would have to code it
>
> For GridView you could change the ColumnSpan and merge manually
> Same for rows with RowSpan
>
> BruceS
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

There's a couple or three (or more now that I think on it) Quite
Interesting algorithms here. Just looking at the first one

1: Split a cell(y,x) horizontally into m cells :
cell(y,x),cell(y,x1),...cell(y,xm) = Split a column into m columns then
recombine all other cell(y',x..xm) into cell(y',x)

y-1,x-1 | y-1,x | y-1,x+1
--------+-------+--------
y,x-1 |  y,x  | y,x+1
--------+-------+--------
y+1,x-1 | y+1,x | y+1,x+1

goes to

y-1,x-1 |        y-1,x            | y-1,x+1
--------+-------------------------+--------
y,x-1 | y,x | y,x1 | ... | y,xm | y,x+1
--------+-------------------------+--------
y+1,x-1 |        y+1,x            | y+1,x+1

Now the cardinality on y could be huge. (which is why I picked this one
:-)
However, for gridviews (and tableviews too, I suppose) this is only OF
INTEREST if the row concerned, y, is visible.

In an extreme case, lets say y cardinality in the order of 10^4 where
the row of the cell to be split is say 9,990 and the user is viewing
rows 0..23 is there any point in splitting/recombining the entire
gridview?

jm20c (hoping all my ascii art above hangs together)
bruce

```