AutoFill(DestinationRange: ITabRange; [Type: TabRangeFillType = 0;][Increment: Double = 0]);
DestinationRange. The range which should be autofilled.
Type. Fill method.
Increment. Fill step.
The AutoFill method automatically fills selected range based on data of the current range.
The Increment parameter works on using the TabRangeFillType.Values fill method.
Autofill copies data from the cells of the current range to selected range. By default both cell data (formula, value, text) and formatting are copied. When copied, the cells alternate with regard to the number of cells in the source range. The clipboard is not used on autofill.
If the source range cell contain any formulas, formulas' data are adjusted relative to the new range.
If the source range includes merged cells, the specified range should also contain merged cells. Position of merged cells in the ranges must match. The error message is displayed when the merging location borders of the combined cell does not match current location of combined cells borders. In other case the repeated merge occurs if merged cells does not match.
To work with data in clipboard, one can use the ITabRange.Copy, ITabRange.Cut, ITabRange.Paste methods.
Executing the example requires that the repository contains a regular report with the REPORT identifier. In the report, the A0:A4 cell range is filled with data.
Add links to the Metabase, Report, Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Regrep: IPrxReport;
Sheet: IPrxSheet;
Table: IPrxTable;
Tsheet: ITabSheet;
SourceRange, DestRange: ITabRange;
Begin
// Get current repository
MB := MetabaseClass.Active;
// Get regular report
Regrep := mb.ItemById("REPORT").Edit As IPrxReport;
// Get regular report sheet table
Sheet := Regrep.Activesheet;
Table := Sheet As IPrxTable;
TSheet := Table.TabSheet;
// Determine fill ranges
SourceRange := TSheet.ParseRange("A0:A4");
DestRange := TSheet.ParseRange("A0:A9");
// Autofit cell range (A5:A9)
SourceRange.AutoFill(DestRange, TabRangeFillType.Values, 2);
(Regrep As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the A5:A9 cell range will be autofilled basing on the A0:A4 range with step 2. Only cell formulas, values and text are copied.
See also: