The grouping feature affects the display and is not intended to work with some other features of Spread that also work with the display of the spreadsheet. When grouping happens, the data model is changed and a new model (the GroupDataModel) is used. Many features are not affected by grouping at all, but some features, listed below, are not intended to operate with grouping. In general, if the feature involves the appearance or interactivity of the sheet or column, check the list to see if it is affected by grouping.
Some formatting features can work with grouping, but need to be applied after grouping occurs. If you need to format cells (colors, locked, and so on), you must apply the formatting after grouping.
After grouping rows, you should not change the column count and row count. The GroupDataModel does not support changing the column or row count.
To add or remove columns or rows, you need to call the original data model methods. You can access the original data model using the TargetModel property of the GroupDataModel class. The type of TargetModel property varies depending on the level of grouping. Therefore, you can fetch the level of the TargetModel property at which it becomes of the DefaultSheetModel type.
The following example code demonstrates how to use the TargetModel property in a GroupDataModel.
C# |
Copy Code
|
---|---|
GroupDataModel groupDataModel = new GroupDataModel(fpSpread1_Sheet1.Models.Data); while (groupDataModel.TargetModel is GroupDataModel) { groupDataModel = (groupDataModel.TargetModel as GroupDataModel); } if(groupDataModel.TargetModel is DefaultSheetDataModel defaultSheetDataModel) { // Perform your desired row or column updates } |
Visual Basic |
Copy Code
|
---|---|
Dim groupDataModel As GroupDataModel = New GroupDataModel(fpSpread1_Sheet1.Models.Data) While TypeOf groupDataModel.TargetModel Is GroupDataModel groupDataModel = TryCast(groupDataModel.TargetModel, GroupDataModel) End While Dim defaultSheetDataModel As DefaultSheetDataModel = Nothing If CSharpImpl.__Assign(defaultSheetDataModel, TryCast(groupDataModel.TargetModel, DefaultSheetDataModel)) IsNot Nothing Then ' Perform your desired row or column updates End If |
The following features can work with grouping or are not affected by grouping:
These features do not interoperate with grouping in Spread.
Feature | Description |
---|---|
Alternating Rows | Grouping and alternating rows do not work together. Grouping changes the order of the rows, so having a display of alternating rows would not make sense. Thus, these features do not work together. |
Clipboard Paste | Pasting does not work with grouping. |
Conditional Formatting | Grouping and conditional formatting do not work together. Conditional formatting requires the default data model. Thus, these features do not work together. |
Filtering | Grouping and filtering do not work together. If you want to use grouping, you should not use filtering and you should clear the filter under the Grouping event. |
Formulas | Grouping and formulas do not work together. Formulas requires the default data model. Thus, these features do not work with grouping. |
Outlines | Grouping (Outlook style) and outlines (range groups) are not intended to work together. |
Sorting | Grouping and sorting do not work together. Grouping is a type of sorting. When grouping is on, clicking on column headers will cause grouping not sorting. Thus, these features do not work together. |
Hierarchical Data Display | Grouping and hierarchical display do not work together. |
Error icons | Error icons do not work with grouping. |