V4 V5

Auto-fill infers the pattern in a source range and extends it into an adjacent one.

1, 3 in A1:A2 extended as an arithmetic series into A3:A10

From the API

ws.SetNumber(0, 0, 1);
ws.SetNumber(1, 0, 3);

// extend the A1:A2 pattern into A3:A10 -> 5, 7, 9, ...
RangePosition filled = ws.AutoFill(
	source: RangePosition.Parse("A1:A2"),
	target: RangePosition.Parse("A3:A10"));

The return value is the range that was actually filled. A target past the sheet’s edge fills up to the edge. A target that grows the source in two or more directions writes nothing and returns the source range.

How the pattern is inferred

Each lane is inferred independently (one column when filling vertically, one row when filling horizontally).

Source contentHow it extends
A formularelative references are offset ($-pinned ones stay; a reference pushed before row 1 or column A gives #REF!)
An arithmetic series (1, 3)continues with the same step (5, 7, 9)
A dateadvances by one day, or by the source’s own interval
A single cell with a time-only formatadvances by one hour
Anything elseis copied (formulas in a lane that mixes values and formulas still have their references offset)

A single number is copied rather than extended (as in Excel). Producing a series needs at least two.

What travels with the values

Not just values — styles, number formats and cell types propagate too, so extending an already-formatted column does not break its appearance.

From the UI

A fill handle appears at the bottom-right of the selection. Dragging it locks to one axis and previews the destination with a dashed outline.

Relationship to copy and paste

Pasting through the clipboard also offsets relative references to suit the destination (the same behaviour as Excel and V4), because the HTML ReoGrid writes carries anchor information.

See Clipboard.

Undo

Auto-fill from a control (the fill handle) is recorded in the history. Calling ws.AutoFill directly does not record it.

Was this article helpful?