Auto-fill (Fill Handle)
Auto-fill exposes Excel’s familiar fill handle — a small square at the bottom-right of the active selection. Drag it down, up, left, or right to extend the selection with values inferred from the source cells.
Detected patterns:
| Source | Behavior |
|---|---|
| Single cell | Tile-copy. The source value is repeated in every target cell. |
| Numeric series (2+ cells) | Arithmetic progression. 1, 2 → 3, 4, 5; 5, 10 → 15, 20, 25. |
| Single date-formatted cell | Increment by one day per step. |
| Cells containing formulas | Relative references shift the way Excel does; $-anchored references are preserved. |
| Styles, number formats, cell types | Propagate from the source to the new region. |
Undo restores prior values, including cells that previously held different data.
Enabling and disabling
Auto-fill is enabled by default.
import { createReogrid } from '@reogrid/lite'
// Disable at construction
const { worksheet } = createReogrid({
workspace: '#grid',
autoFill: false,
})
// Toggle at runtime
worksheet.setAutoFillEnabled(true)
worksheet.setAutoFillEnabled(false)
In React / Vue, pass options={{ autoFill: false }} to the <Reogrid> component if you want to ship without the fill handle.
Programmatic fill
For tooling and tests, the value-inference logic is exposed as a pure function so you can compute the same series the UI would produce.
import { computeAutoFillValues, type AutoFillSourceCell } from '@reogrid/pro'
const source: AutoFillSourceCell[][] = [
[{ input: '1' }],
[{ input: '2' }],
]
const result = computeAutoFillValues({ source, direction: 'down', steps: 5 })
// result -> [[{ input: '3' }], [{ input: '4' }], [{ input: '5' }], [{ input: '6' }], [{ input: '7' }]]
Combine with AutoFillAction if you need to drive the fill through the standard undo/redo pipeline:
import { AutoFillAction } from '@reogrid/pro'
// Fill A1:A2 down through A7 (the target range contains the source)
const action = new AutoFillAction(
{ topRow: 0, leftColumn: 0, bottomRow: 1, rightColumn: 0 },
{ topRow: 0, leftColumn: 0, bottomRow: 6, rightColumn: 0 },
)
grid.actionManager.execute(action)
Notes
- The fill handle is drawn as part of the selection chrome, so it follows the active selection automatically.
- Custom series like weekday names (
Mon, Tue, ...) or month names are not detected in this release — they tile-copy instead. - Double-clicking the fill handle to auto-extend downward is not yet supported.