SpreadJS supports the drag and merge operation by allowing users to select cells and drag the selection to merge cells.
Drag and merge operation provides a great way when you want to create a new, larger cell using other cells in a spreadsheet or simply when you need to create a label that spans several columns or rows.
The allowUserDragMerge option of the workbook can be used to control whether or not to allow users to merge cells via mouse drag.
By default, the allowUserDragMerge option is set to boolean false and the cells behave in normal mode. However, when this option is set to true, an indicator in the selection border will appear as shown in the below image.
This example shows how to allow users to perform the drag merge operation. The options.allowUserDragMerge property is used to specify whether to allow the drag merge operation in the worksheet.
JavaScript |
Copy Code
|
---|---|
// Allow users to merge cells via mouse drag spread.options.allowUserDragMerge = true; |
For more information, please refer to Creating Cell Spans.
The drag merge operation has the following limitations: