SSGetRowMerge, SSSetRowMerge Functions
Applies To
fpSpread DLL control
Description
Set or return whether or how cells in a row that have the same content are grouped in a single cell spanning multiple columns.
Syntax
short SSGetRowMerge(HWND hWnd, SS_COORD Row);
void SSSetRowMerge(HWND hWnd, SS_COORD Row, short nRowMerge);
short TSpread::GetRowMerge(SS_COORD Row);
void TSpread::SetRowMerge(SS_COORD Row, short nRowMerge);
Parameters
The SSGetRowMerge function and SSSetRowMerge functions have the following parameters:
Parameter | Description | |
---|---|---|
hWnd | Window handle of the fpSpread control | |
Row | Row number of row to set or return merge information | |
nRowMerge | Specifies how cells within a row 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 top are also merged |
Note: You cannot set the Row parameter to SS_ALLROWS to specify that all rows allow merging. You must specify the merge setting for each row 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.
The following figure illustrates setting SS_MERGE_RESTRICTED. In the figure, row 1 is set to SS_MERGE_ALWAYS and row 2 is set to SS_MERGE_RESTRICTED. As shown in the figure, the cells in row 2 merge only when the cells immediately above them are also merged. Cell A2 would merge with cells B2 and C2 if the user typed "cats" 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 nRowMerge 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 row 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 SSSetColMerge function to specify whether and how to merge cells that have the same content in a column.
Return Value
SSGetRowMerge: Setting for the merge. One of the values listed for the nRowMerge parameter of the SSSetRowMerge function.
See Also
SSGetColMerge, SSSetColMerge, SSSetSheet functions
ActiveX Correspondence
RowMerge property