SpreadJS allows users to automatically fill data (formulas and values) in the columns of the worksheet. Users can simply double-click the fill handle of a selected cell to fill the contents in the cell down an entire column. The fill handle allows users to fill data using four different type of options - Copy Cells, Fill Series, Fill Formatting Only and Fill Without Formatting.
While working with business applications, users often need to deal with worksheets having hundreds or thousands of rows of data that contain formulas. Using the double-click for auto fill allows the users to quickly and conveniently autofill the column formulas without having to use the mouse to manually drag and fill, saving the end user time and reducing possible errors.
Upon double-clicking the fill handle, the empty cells down the column (called fillRange) will be filled depending upon the contents of the startRange (the cell range that already contains data).
Shared below are the various auto fill operations that can be executed using double-click.
Note: The following points should be kept in mind while working with double-click for auto fill operations.
1) This type of auto fill works only when there are non-empty cells in the column adjacent to the fill handle.
2) When you double-click the fill handle in order to fill data in the columns, it will only extend down to the last non-empty cell in the current region.
3) Also, in case your adjacent column contains some empty cells, double-clicking the fill handle will fill the column upto the last non-empty cell in the adjacent column.
Refer to the following code snippet in order to auto fill values and formulas using double-click in the spreadsheet.
JavaScript |
Copy Code
|
---|---|
// Auto fill Numeric Values and Formulas var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 4 }); // Set values in the default worksheet var sheet1 = spread.getSheet(1); // Set values in the "sheet1" worksheet sheet1.setValue(0, 1, 'Price'); var sheet2 = spread.getSheet(2); // Set values in the "sheet2" worksheet sheet2.setFormula(1, 4, '=B2*C2'); var sheet3 = spread.getSheet(3); // Set values in the "sheet3" worksheet sheet3.setFormula(1, 0, '=C2*D2'); |