CGridView:UnJoinCells


The UnJoinCells method removes the joining of merged cells. This returns the joined block to individual cells. The coordinates of the join block are specified in units of the original column and row location of the original cell.

Syntax

CGridView:UnJoinCells( nCol, nRow )

bullet.gif    where nCol, and nRow refers to the cell to unjoin.

Example

The following script creates a grid with 2 heading rows and joins the top-most row to cover groups of 3 columns. The heading row closest to the grid body (row index 0) is filled with default column labels (that may be changed using SetStr for columns in row 0). Cells in the second heading row at index -1 are joined into groups of 3 columns each and the labels "A", "B", "C", and "D" are assigned to the 4 joined column headings. Then the second joined cell is unjoined:

params =

-- define the grid properties

{

 

  nCols = 12,

-- create 12 columns

  nRows = 20,

 

  nSheets = 1,

 

  nSH_Cols = 1,

 

  nSH_Width = 24,

 

  nTH_Rows = 2,

-- create 2 top heading rows

  nTH_Height = 16,

-- each top heading row has a height of 16

}

 

G = new_gridview("My Grid", params )

-- create a new CGridView window

label = { "A", "B", "C", "D" }

-- create some simple labels

nJoinLabel = 1

-- index for accessing join labels

nCols = G:GetNumCols()

-- get the column count

for nCol = 1,nCols,3 do

-- step every 3rd column

  G:JoinCells( nCol, nCol+2, -1, -1)

-- join the 3 columns, from nCol through nCol+2

  G:SetHorzAlign( nCol, -1, 3 )

-- 3 means align center

  G:SetStr(nCol, -1, label[nJoinLabel])

-- set the title of the joined heading cells

  nJoinLabel = nJoinLabel + 1

-- point index to the next label

end

 

G:UnJoinCells( 4, -1)

unjoin the second joined header cell.

Related Topics

CGridView class

JoinCells


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.