SpreadJS 13
GC.Spread.Sheets Namespace / Worksheet type / fillAuto Method
The fill start range.
The entire range to fill.
The range fill information.
Specifies how to fill the specified range. GC.Spread.Sheets.Fill.FillType.direction:
Fills the specified range in the specified direction.
GC.Spread.Sheets.Fill.FillType.linear:
Fills the specified range using a linear trend when the source value type is number.
The next value is generated by the step and stop values.
The next value is computed by adding the step value to the current cell value.
GC.Spread.Sheets.Fill.FillType.growth:
Fills the specified range using a growth trend when the source value type is number.
The next value is generated by the step and stop values.
The next value is computed by multiplying the step value with the current cell.
GC.Spread.Sheets.Fill.FillType.date:
Fills the specified range when the source value type is date.
The next value is generated by adding the step value to the current value.
The step value is affected by the fill date unit.
GC.Spread.Sheets.Fill.FillType.auto:
Fills the specified range automatically.
When the value is a string, the value is copied to other cells.
When the value is a number, the new value is generated by the TREND formula.
The fill series.
direction The fill direction.
step - The fill step value.
stop - The fill stop value.
unit The fill date unit.
In This Topic
    fillAuto Method
    In This Topic
    Fills the specified range automatically.
    Syntax
    var instance = new GC.Spread.Sheets.Worksheet(name);
    var value; // Type: any
    value = instance.fillAuto(startRange,
                              wholeRange,
                              options,
                              options.fillType,
                              options.series,
                              options.direction,
                              options.step,
                              options.stop,
                              options.unit);
    function fillAuto( 
       startRange : Range,
       wholeRange : Range,
       options : Object,
       (optional) options.fillType : FillType,
       (optional) options.series : FillSeries,
       (optional) options.direction : FillDirection,
       (optional) options.step : number,
       (optional) options.stop : undefined,
       (optional) options.unit : FillDateUnit
    ) : any;

    Parameters

    startRange
    The fill start range.
    wholeRange
    The entire range to fill.
    options
    The range fill information.
    options.fillType
    Specifies how to fill the specified range. GC.Spread.Sheets.Fill.FillType.direction:
    Fills the specified range in the specified direction.
    GC.Spread.Sheets.Fill.FillType.linear:
    Fills the specified range using a linear trend when the source value type is number.
    The next value is generated by the step and stop values.
    The next value is computed by adding the step value to the current cell value.
    GC.Spread.Sheets.Fill.FillType.growth:
    Fills the specified range using a growth trend when the source value type is number.
    The next value is generated by the step and stop values.
    The next value is computed by multiplying the step value with the current cell.
    GC.Spread.Sheets.Fill.FillType.date:
    Fills the specified range when the source value type is date.
    The next value is generated by adding the step value to the current value.
    The step value is affected by the fill date unit.
    GC.Spread.Sheets.Fill.FillType.auto:
    Fills the specified range automatically.
    When the value is a string, the value is copied to other cells.
    When the value is a number, the new value is generated by the TREND formula.
    options.series
    The fill series.
    options.direction
    direction The fill direction.
    options.step
    step - The fill step value.
    options.stop
    stop - The fill stop value.
    options.unit
    unit The fill date unit.
    Example
    This example automatically fills the data in an area of the sheet.
    activeSheet.setValue(0, 0, 5);
    var start = new GC.Spread.Sheets.Range(0, 0, 1, 1);
    var r3 = new GC.Spread.Sheets.Range(0, 0, 4, 1);
    activeSheet.fillAuto(start,r3, {fillType:GC.Spread.Sheets.Fill.FillType.auto, series:GC.Spread.Sheets.Fill.FillSeries.column, fillDirection:GC.Spread.Sheets.Fill.FillDirection.down});
    This example automatically fills ranges.
    spread.options.allowUserDragFill = true;
    
    activeSheet.setValue(0, 0, new Date(2011, 1, 1));
    activeSheet.setValue(0, 1, new Date(2011, 2, 9));
    activeSheet.setValue(0, 2, 5);
    activeSheet.setValue(0, 3, 10);
    activeSheet.setValue(0, 4, 1);
    
    var start = new GC.Spread.Sheets.Range(0, 0, 1, 1);
    var r = new GC.Spread.Sheets.Range(0, 0, 4, 1);
    activeSheet.fillAuto(start, r, {
        fillType: GC.Spread.Sheets.Fill.FillType.date,
        series: GC.Spread.Sheets.Fill.FillSeries.column,
        fillDirection: GC.Spread.Sheets.Fill.FillDirection.down,
        unit: GC.Spread.Sheets.Fill.FillDateUnit.day,
        step: 1,
        stop: new Date(2011, 2, 11)
    });
    
    start = new GC.Spread.Sheets.Range(0, 1, 1, 1);
    var r2 = new GC.Spread.Sheets.Range(0, 1, 4, 1);
    activeSheet.fillAuto(start, r2, {
    fillType: GC.Spread.Sheets.Fill.FillType.date,
    series: GC.Spread.Sheets.Fill.FillSeries.column,
    fillDirection:GC.Spread.Sheets.Fill.FillDirection.down,
    unit: GC.Spread.Sheets.Fill.FillDateUnit.day,
    step: 1,
    stop: new Date(2011, 2, 11)
    });
    
    start = new GC.Spread.Sheets.Range(0, 2, 1, 1);
    var r3 = new GC.Spread.Sheets.Range(0, 2, 4, 1);
    activeSheet.fillAuto(start, r3, {
        fillType: GC.Spread.Sheets.Fill.FillType.auto,
        series: GC.Spread.Sheets.Fill.FillSeries.column,
    });
    
    start = new GC.Spread.Sheets.Range(0, 3, 1, 1);
    var r4 = new GC.Spread.Sheets.Range(0, 3, 4, 1);
    activeSheet.fillAuto(start, r4, {
        fillType: GC.Spread.Sheets.Fill.FillType.growth,
        series: GC.Spread.Sheets.Fill.FillSeries.column,
        step:2,
        stop:55
    });
    
    start = new GC.Spread.Sheets.Range(0, 4, 1, 1);
    var r5 = new GC.Spread.Sheets.Range(0, 4, 4, 1);
    activeSheet.fillAuto(start, r5, {
        fillType: GC.Spread.Sheets.Fill.FillType.linear,
        series: GC.Spread.Sheets.Fill.FillSeries.column,
        step:3,
        stop:20
    });
    
    activeSheet.setValue(0, 5, 123);
    var r6 = new GC.Spread.Sheets.Range(0, 5, 4, 1);
    activeSheet.fillAuto(new GC.Spread.Sheets.Range(0, 5, 1, 1), r6, {
        fillType: GC.Spread.Sheets.Fill.FillType.auto,
        series: GC.Spread.Sheets.Fill.FillSeries.column,
    });
    See Also

    Reference

    Worksheet type