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

GraphText Clear method

Declaration

procedure Clear;

Description

This method can be used to clear the internal memory of the GraphText 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 method is only applied to the GraphText object of the current Report/Subreport specified in the Subreports object. Therefore, to clear all the GraphText of all the Subreports will require a looping procedure that goes through each Subreport and applies the Clear method.

Example

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

Crpe1.GraphText.Clear;

This code clears the GraphText properties for all the Subreports:

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

Crpe1.Subreports[cnt];

Crpe1.GraphText.Clear; end;

GraphText CopyFrom method

Declaration

function CopyFrom(Source: TCrpeGraphText): boolean;

Description

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

VCL Reference

338

Example

The following example copies all the GraphText property values to a temporary TCrpeGraphText object:

var

tempGraphText : TCrpeGraphText; begin

tempGraphText := TCrpeGraphText.Create; tempGraphText.CopyFrom(Crpe1.GraphText); {...later, when finished with the temp object...} tempGraphText.Free;

end;

GraphText Count method

Declaration

function Count: integer;

Description

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

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.GraphText.Retrieve;

for cnt := 0 to (Crpe1.GraphText.Count - 1) do Crpe1.GraphText[cnt].Title := 'Company Graph';

end;

GraphText Create method

Declaration

constructor Create;

Description

The Create method is used internally in the Crystal component to create the GraphText object, and does not need to be called in code.

VCL Reference

339

GraphText Delete method

Declaration

procedure Delete(nIndex: integer);

Description

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

Example

The Delete method can be used to manually remove an item from the GraphText object:

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

{Specify Graph number - must be same as in Report} Crpe1.GraphText.Add(0);

{Section must also be specified when using Add} Crpe1.GraphText.Section := 'PH'; Crpe1.GraphText.Title := 'Company Graph'; Crpe1.Output := toWindow;

Crpe1.Execute;

Crpe1.GraphText.Delete(0);

GraphText Destroy method

Declaration

destructor Destroy; override;

Description

The Destroy method is used internally in the Crystal component and does not need to be called in code.

GraphText Retrieve method

Declaration

function Retrieve: boolean;

VCL Reference

340

Description

The Retrieve method obtains the GraphText information from the Report and stores it in the GraphText object. If no GraphText information was found, the call returns False. Be aware that calling Retrieve will first cause the GraphText object to be cleared, so any current information stored in it will be removed.

NOTE: Since the GraphText object also applies to Subreports, the Retrieve method will obtain the GraphText for the Report (or Subreport) that the Subreports object index is currently pointing to. If you want to obtain the GraphText information for the main Report and all of the Subreports, you will have to step through the Subreports object and call Retrieve for each item. The VCL will store separate GraphText information for each Subreport (see Example).

Example

The following code illustrates the use of the Retrieve method for the main Report:

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

Crpe1.GraphText.Retrieve;

The following code illustrates the use of the Retrieve method for the main Report and any Subreports:

var

cnt: integer; begin

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

{Loop through Reports and Retrieve}

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

Crpe1.Subreports[cnt];

Crpe1.GraphText.Retrieve; end;

{Set Crpe component back to main Report} Crpe1.Subreports[0];

end;

GraphText SectionType method

Declaration

function SectionType: string;

Description

The SectionType method returns the Section Code without the subsection specifier. In other words, if the Section Code for an item is GH1ac, the SectionType method would return GH; if the SectionCode is Da, the SectionType method would return D.

VCL Reference

341

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