Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
163
Добавлен:
11.05.2015
Размер:
4.73 Mб
Скачать

AreaFormatFormulas Methods

AreaFormatFormulas Add method

Declaration

procedure Add(SectionName: TCrAreaFormatFormulasSection);

Type

TCrAreaFormatFormulasSection = string;

Description

The Add method adds an item to the AreaFormatFormulas object and sets the internal index to that item. It requires a Section name as a parameter, which should be a name corresponding to a Section in the Report. Sections are named using the Short Section Name convention used in Crystal Reports (see About Section Names, Volume 1, Chapter 7, for more information). If the Add method is used, the steps to using AreaFormatFormulas are:

1Add an item to the AreaFormatFormulas object (you must specify the Section name).

2Specify values for the properties (Name, Formula, etc.).

3When Execute is called, the properties will be sent to the Print Engine.

NOTE: It is easier to use the Retrieve method instead of Add, since it ensures that the number of items, and the Section names are correct for the current Report.

Example

The Add method can be used to manually add an item to the AreaFormatFormulas object, instead of using Retrieve:

Crpe1.ReportName := 'C:\Company.rpt';

{Specify Section Name - must be same as in Report} Crpe1.AreaFormatFormulas.Add('PH'); Crpe1.AreaFormatFormulas.Name := afSuppress; Crpe1.AreaFormatFormulas.Formula.Text := 'True'; Crpe1.Output := toWindow;

Crpe1.Execute;

VCL Reference

238

AreaFormatFormulas Check method

Declaration

function Check: boolean;

Description

The Check method can be used to check the syntax of an AreaFormatFormula before running the Report. Check returns a boolean value:

True - AreaFormatFormula is good.

False - AreaFormatFormula has an error.

NOTE: Check is not working properly at this time (it always returns True).

Example

The Check method does not work properly for AreaFormatFormulas at this time.

AreaFormatFormulas Clear method

Declaration

procedure Clear;

Description

This method can be used to clear the internal memory of the AreaFormatFormulas object. It is called automatically if the Clear method is called for the main component, or if a new Report name is assigned to the ReportName property, but may be called in code as desired.

The Clear is only applied to the AreaFormatFormulas object of the current Report/Subreport specified in the Subreports object. Therefore, to clear all the AreaFormatFormulas of all the Subreports will require a looping procedure that goes through each Subreport and applies the Clear.

Example

This code clears the AreaFormatFormulas properties for the main Report (assuming the default state of Subreports[0]):

Crpe1.AreaFormatFormulas.Clear;

VCL Reference

239

This code clears the AreaFormatFormulas for all the Subreports:

for cnt := 1 to (Crpe1.Subreports.Count - 1) do begin

Crpe1.Subreports[cnt];

Crpe1.AreaFormatFormulas.Clear; end;

AreaFormatFormulas CopyFrom method

Declaration

function CopyFrom(Source: TCrpeAreaFormatFormulas): boolean;

Description

The CopyFrom method copies the AreaFormatFormulas property values from another TCrpeAreaFormatFormulas object. It is similar to Delphi's Assign method. It is useful for transferring or temporary storage of values.

Example

The following example copies all the AreaFormatFormulas property values to a temporary TCrpeAreaFormatFormulas object:

var

tempAreaFormatFormulas : TCrpeAreaFormatFormulas; begin

tempAreaFormatFormulas := TCrpeAreaFormatFormulas.Create; tempAreaFormatFormulas.CopyFrom(Crpe1.AreaFormatFormulas); {...later, when finished with the temp object...} tempAreaFormatFormulas.Free;

end;

AreaFormatFormulas Count method

Declaration

function Count: integer;

Description

The Count method can be used to obtain the number of items currently in the AreaFormatFormulas object. It is handy for setting up loops to make similar changes to each item.

VCL Reference

240

Example

The Count method is useful for looping constructions. You would normally want to call Retrieve first:

var

cnt: integer; begin

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.AreaFormatFormulas.Retrieve;

for cnt := 0 to (Crpe1.AreaFormatFormulas.Count - 1) do begin

Crpe1.AreaFormatFormulas[cnt].Name := afKeepTogether; Crpe1.AreaFormatFormulas[cnt].Formula.Text := 'True';

end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

AreaFormatFormulas Create method

Declaration

constructor Create;

Description

The Create constructor creates the AreaFormatFormulas object. It is used internally in the VCL component to create the AreaFormatFormulas object when the component is created, and should not be called outside of the component.

AreaFormatFormulas Delete method

Declaration

procedure Delete(nIndex: integer);

Description

The Delete method can be used to remove an item from the AreaFormatFormulas object. The "nIndex" parameter represents the number of the item in the AreaFormatFormulas object.

VCL Reference

241

Соседние файлы в папке crystal