ITabRange.AutoFill

Syntax

AutoFill(DestinationRange: ITabRange; [Type: TabRangeFillType = 0;][Increment: Double = 0]);

AutoFill(DestinationRange: Prognoz.Platform.Interop.Tab.ITabRange; Type: Prognoz.Platform.Interop.Tab.TabRangeFillType; Increment: double);

Parameters

DestinationRange. The range which should be autofilled.

Type. Fill method.

Increment. Fill step.

Description

The AutoFill method automatically fills selected range based on data of the current range.

Comments

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.

The Copy/Cut/Paste methods can be used on working with the clipboard. The Fore.NET also allows working with the analogous methods via the streams: CopyToStream/CutToStream/PasteFromStream.

Example

To execute the example the repository must contain 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 table of regular report sheet
    Sheet := Regrep.Activesheet;
    Table := Sheet 
As IPrxTable;
    TSheet := Table.TabSheet;
    
// Determine fill ranges
    SourceRange := TSheet.ParseRange("A0:A4");
    DestRange := TSheet.ParseRange(
"A0:A9");
    
// Autofill cell range (A5:J9)
    SourceRange.AutoFill(DestRange, TabRangeFillType.Values, 2);
    (Regrep 
As IMetabaseObject).Save;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Regrep: IPrxReport;
    Sheet: IPrxSheet;
    Table: IPrxTable;
    Tsheet: ITabSheet;
    SourceRange, DestRange: ITabRange;
Begin
    
// Get current repository
    MB := Params.Metabase;
    
// Get regular report
    Regrep := mb.ItemById["OBJ105835"].Edit() As IPrxReport;
    
// Get table of regular report sheet
    Sheet := Regrep.Activesheet;
    Table := Sheet 
As IPrxTable;
    TSheet := Table.TabSheet;
    
// Determine autofill ranges
    SourceRange := TSheet.ParseRange("A0:A4");
    DestRange := TSheet.ParseRange(
"A0:A9");
    
// Autofill the cell range (A5:J9)
    SourceRange.AutoFill(DestRange, TabRangeFillType.trftValues, 2);
    (Regrep 
As IMetabaseObject).Save();
End Sub;

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:

ITabRange