Macro Reference — Document Object — AutoFill Method (Document Object)

# AutoFill Method (Document Object)

Performs the AutoFill or Flash Fill action on the CSV document.

##

### [JavaScript]

    nResults = document.AutoFill( xSrcCellStart, ySrcCellStart, xSrcCellEnd, ySrcCellEnd, xDestCellStart, yDestCellStart, xDestCellEnd, yDestCellEnd, nFlags, nIncrement );

### [VBScript]

    nResults = document.AutoFill( xSrcCellStart, ySrcCellStart, xSrcCellEnd, ySrcCellEnd, xDestCellStart, yDestCellStart, xDestCellEnd, yDestCellEnd, nFlags, nIncrement )

## Parameters

xSrcCellStart

Specifies the column number of the starting position of the source cells.

ySrcCellStart

Specifies the line number of the starting position of the source cells.

xSrcCellEnd

Specifies the column number of the ending position of the source cells.

ySrcCellEnd

Specifies the line number of the ending position of the source cells.

xDestCellStart

Specifies the column number of the starting position of the destination cells.

yDestCellStart

Specifies the line number of the starting position of the destination cells.

xDestCellEnd

Specifies the column number of the ending position of the destination cells.

yDestCellEnd

Specifies the line number of the ending position of the destination cells.

nFlags

Specifies a combination of the following values. If omitted, eeFillDefault will be specified.

eeFillDefault | EmEditor determines the values to fill the destination cells.
eeFillCopy | Copies the values from the source range to the target range, repeating if necessary.
eeFillSeries | Extends the values in the source range into the target range as a series.
eeFlashFill | Performs the Flash Fill action, i.e. extends the values from the source range into the target range based on the detected pattern. This flag is valid only for the vertical direction.
eeFillDontOverwrite | The AutoFill action will not overwrite the existing cells in the target range. Cannot combine with eeFlashFill.
eeFillRepeat | The AutoFill action will be repeated with the new value on a non-empty cell. Cannot combine with eeFlashFill.

nIncrement

Specifies the number of increment for a series if only one cell is specified for the source range and if eeFillSeries is specified for the nFlags parameter. If omitted, 1 will be specified.

## Return Values

The return value can be a combination of the following values if the method succeeds. The return value of 0 means the method couldn't detect the pattern to complete the AutoFill or Flash Fill action. A negative value means the message failed.

eeFillDefault | Copies the values from the source range to the target range, repeating if necessary.
eeFillSeries | Extends the values in the source range into the target range as a series.
eeFlashFill | Performs the Flash Fill action, i.e. extends the values from the source range into the target range based on the detected pattern. This flag is valid only for the vertical direction.

## Examples

### [JavaScript]

    nResults = document.AutoFill( 1, 1, 2, 3, 1, 1, 5, 3, eeFillSeries | eeFillDontOverwrite );
    if( nResults >= 0 ) {
    alert( "Success" );
    }

### [VBScript]

    nResults = document.AutoFill( 1, 1, 2, 3, 1, 1, 5, 3, eeFillSeries Or eeFillDontOverwrite );
    If nResults >= 0 Then
    alert "Success"
    End If

## Version

Supported on EmEditor Professional Version 17.5 or later.