SpreadJS 13
GC.Spread.Sheets Namespace / Commands type / fill Field
In This Topic
    fill Field
    In This Topic
    Represents the command used to drag and fill a range on the sheet.
    Syntax
    var value; // Type: fill
    value = GC.Spread.Sheets.Commands.fill;
    var fill : fill;
    Example
    This example fills a range.
    //Add data
    for (var col = 1; col < 6; col++) {
        for (var row = 2; row < 11; row++) {
            activeSheet.setValue(row, col, row + col);
        }
    }
    
    $("#button1").click(function () {
    spread.options.allowUndo = true;
    var srange = new GC.Spread.Sheets.Range(10, 5, 1, 1);
    var frange = new GC.Spread.Sheets.Range(11, 5, 5, 1);
    spread.commandManager().execute({cmd: "fill", sheetName: "Sheet1", startRange: srange, fillRange: frange, autoFillType: GC.Spread.Sheets.Fill.AutoFillType.fillSeries, fillDirection: GC.Spread.Sheets.Fill.FillDirection.down });
    });
    
    <input type="button" id="button1" value="button1"/>
    This example fills a range with the cell formatting.
    activeSheet.getCell(0, 0).backColor("yellow");
    activeSheet.getCell(0, 0).value(10);
    activeSheet.setValue(0, 2, 15);            
    var sourceRange = new GC.Spread.Sheets.Range(0, 0, 1, 1);
    var targetRange = new GC.Spread.Sheets.Range(0, 1, 1, 3);
    spread.options.allowUndo = true;
    spread.commandManager().execute({cmd: "fill", sheetName: "Sheet1", startRange:sourceRange, fillRange: targetRange, autoFillType: GC.Spread.Sheets.Fill.AutoFillType.fillFormattingOnly, fillDirection: GC.Spread.Sheets.Fill.FillDirection.right});
    Remarks

    dragFillExtent - The drag fill extent information.

    startRange {GC.Spread.Sheets.Range} - Indicates the drag fill start range.
    fillRange {GC.Spread.Sheets.Range} - Indicates the drag fill end range.
    autoFillType {GC.Spread.Sheets.AutoFillType} - Indicates the type of the drag fill.
    fillDirection {GC.Spread.Sheets.FillDirection} - Indicates the drag fill direction.

    See Also

    Reference

    Commands type