Spread 8.0 Documentation
SSGetColMerge, SSSetColMerge Functions
Support Options
DLL Reference > DLL Functions > SSGetColMerge, SSSetColMerge Functions

Glossary Item Box

SSGetColMerge, SSSetColMerge Functions


See Also    ActiveX

Applies To

fpSpread DLL control

Description

Set or return whether or how cells in a column that have the same content are grouped in a single cell spanning multiple rows.

Syntax

C

short SSGetColMerge(HWND hWnd, SS_COORD Col);

void SSSetColMerge(HWND hWnd, SS_COORD Col, short nColMerge);

C++

short TSpread::GetColMerge(SS_COORD Col);

void TSpread::SetColMerge(SS_COORD Col, short nColMerge);

Parameters

The SSGetColMerge and SSSetColMerge functions have the following parameters:

Parameter Description
hWnd Window handle of the fpSpread control
Col Column number of column to set or return merge information
nColMerge Specifies how cells within a column are merged
Use one of the following values:
Constant Description
SS_MERGE_NONE Cells with the same content are not merged
SS_MERGE_ALWAYS Cells with the same content are always merged
SS_MERGE_RESTRICTED Cells with the same content are merged only when adjacent cells to the left are also merged

Note: You cannot set the Col parameter to SS_ALLCOLS to specify that all columns allow merging. You must specify the merge setting for each column individually.

Remarks

This function is applied to the current sheet setting unless you first call the SSSetSheet function to specify the sheet for which you are calling this function.

If a merged column overlaps a span then the merged column replaces the span.

The following figure illustrates setting SS_MERGE_RESTRICTED. In the figure, column A is set to SS_MERGE_ALWAYS and column B is set to SS_MERGE_RESTRICTED. As shown in the figure, the cells in column B merge only when the cells immediately to the left of them are also merged. Cell B1 would merge with cells B2 and B3 if the user typed "birds" in cell A1.

Merged cells take on the properties of the top-left merged cell. For example, if the top-left merged cell has a blue background color, the cells that merge with it display the same background color.

Merged cells do not lose their data; it is simply hidden by the merge. If you remove the merge, for example, by setting the nColMerge parameter to 0 (None), the data appears in each cell that was in the merge. You can edit a cell that is merged with another cell. When you double-click the cell to turn edit mode on, the contents of the cell appear in the cell for you to edit them. When you leave edit mode, if the contents of the cell are no longer identical to the cell or cells with which it was previously merged, the cells are no longer displayed as merged.

Cells that are different cell types but have the same contents can merge. For example, a date cell might contain the contents "01/31/02" and the adjacent edit cell might contain the same contents; if the column containing the cells is set to merge, the cells will merge. If the contents change or the merge is removed, the cells maintain their cell types as well as their data.

Call the SSSetRowMerge function to specify whether and how to merge cells that have the same content in a row.

Return Value

SSGetColMerge: Setting for the merge. One of the values listed for the nColMerge parameter of the SSSetColMerge function.

See Also

Merging Cells

SSGetRowMerge, SSSetRowMerge, SSSetSheet functions

ActiveX Correspondence

ColMerge property

Copyright © GrapeCity, inc. All rights reserved.