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

Example

The following example copies all the GraphType property values to a temporary TCrpeGraphType object:

var

tempGraphType : TCrpeGraphType; begin

tempGraphType := TCrpeGraphType.Create; tempGraphType.CopyFrom(Crpe1.GraphType); {...later, when finished with the temp object...} tempGraphType.Free;

end;

GraphType Count method

Declaration

function Count: integer;

Description

The Count method can be used to obtain the number of items currently in the GraphType 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.GraphType.Retrieve;

for cnt := 0 to (Crpe1.GraphType.Count - 1) do Crpe1.GraphType[cnt].Style := ThreeDBars;

end;

GraphType Create method

Declaration

constructor Create;

Description

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

VCL Reference

350

GraphType Delete method

Declaration

procedure Delete(nIndex: integer);

Description

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

Example

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

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

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

{Section must also be specified when using Add} Crpe1.GraphType.Section := 'PH'; Crpe1.GraphType.Style := ThreeDBars; Crpe1.Output := toWindow;

Crpe1.Execute;

Crpe1.GraphType.Delete(0);

GraphType 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.

GraphType Retrieve method

Declaration

function Retrieve: boolean;

VCL Reference

351

Description

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

NOTE: Since the GraphType object also applies to Subreports, the Retrieve method will obtain the GraphType for the Report (or Subreport) that the Subreports object index is currently pointing to. If you want to obtain the GraphType 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 GraphType 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.GraphType.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.GraphType.Retrieve; end;

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

end;

GraphType 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

352

The primary use for this method is to apply changes to all the Sections in an area, regardless of the sub-section specifier. See the Example for an illustration.

Example

The following example uses the SectionType method to apply conditional changes to Graphs. In this case, there is a Graph in each of three sections (RH, GH1a, GH2a). Only the Graphs in the Group Headers should be changed, so the SectionType method can be used in an expression to apply the changes:

var

cnt: integer; begin

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

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

{if the SectionType is GroupHeader, apply the change} if (Crpe1.GraphType[cnt].SectionType = 'GH') then

Crpe1.GraphType[cnt].Style := Pie;

end; end;

GraphType Send method

Declaration

function Send: boolean;

Description

The Send method sends the GraphType values to the Crystal Reports Print Engine. This method is called automatically when the Execute method is called, provided that SendOnExecute is set to True.

It is strongly recommended that you leave SendOnExecute to True, and let the Crystal Reports component send the values to the Print Engine. If you set the SendOnExecute property to False, each Sub-class and each property that does not belong to a Sub-class must be manually sent before calling the Execute method. This feature is mainly provided for debugging purposes.

Example

In this example, the GraphType settings are sent from the Crystal component to the Crystal Reports Print Engine DLL. This is normally handled automatically in the Execute method:

Crpe1.GraphType.Send;

VCL Reference

353

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