I'm performing cell merge and it doesn't seem to be working
Chinamayu,
Your requirement is "To perform cell merge, but it doesn't seem to be working". Based on the row index, merging should occur from top to bottom and left to right within the index range. Therefore, we need to set the top as the row index value. However, if we do not set the row index condition, we can access merging anywhere in the column setting top and bottom as proper value. We have prepared a sample based on your requirements. If we have misunderstood your requirements, kindly modify the sample to replicate the issue. This will be helpful in proceeding further.
Attachment: Sample_f4abd00.zip
| A | B | E | F | G | |
| CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC | |||||
I wanted it to look like this
Yu ma ,
"We have prepared the sample based on your requirements. In the coveredcellinfo, the left value represents the starting column index to be merged, the right value represents the column index of the last value to be merged, the top value represents the starting row index, and the bottom value represents the ending row index. If you provide the proper values, the merging will be done. If we have misunderstood your requirements, kindly modify the sample to replicate the issue. This will be helpful in proceeding further."
Attachment: Sample_d44439d4.zip
1.Problem solved. Thank you. I misunderstood the meaning of the method
2.But after merging, you can't edit cells, right?
Yu ma,
"We can edit the cell after merging. By default, the DataGrid (SfDataGrid) does not allow cell merging when the SelectionMode is set to anything other than None. However, this behavior can be overcome by setting the ExternalExceptionThrownEventArgs.Handled to true using the ExternalExceptionThrown event. In the meantime, set the selection unit as row in case of editing a merged cell because we are merging a row , so we set the Selectionunit as row.
Code snippet:
|
this.sfDataGrid1.ExternalExceptionThrown += sfDataGrid1_ExternalExceptionThrown; void sfDataGrid1_ExternalExceptionThrown(object sender, Syncfusion.WinForms.DataGrid.Events.ExternalExceptionThrownEventArgs e) { e.Handled = true; } |
UG Link : https://help.syncfusion.com/windowsforms/datagrid/merging#limitations