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

Example

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

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

Crpe1.GraphOptions.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.GraphOptions.Retrieve; end;

{Set Crpe component back to main Report}

Crpe1.Subreports[0]; end;

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

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.

VCL Reference

326

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

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

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

Crpe1.GraphOptions[cnt].Legend := cTrue;

end; end;

GraphOptions Send method

Declaration

function Send: boolean;

Description

The Send method sends the GraphOptions 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 GraphOptions settings are sent from the Crystal component to the Crystal Reports Print Engine DLL. This is normally handled automatically in the Execute method:

Crpe1.GraphOptions.Send;

VCL Reference

327

GraphText Properties

GraphText FootNote property

Declaration

property FootNote: TCrGraphTextType;

Type

TCrGraphTextType = string[128];

Description

The FootNote property specifies the footnote text that will appear under the Graph.

Example

The following example retrieves the GraphText information from the Report, then changes the FootNote text for the first Graph:

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

if Crpe1.GraphText.Count > 0 then Crpe1.GraphText[0].FootNote := 'New FootNote';

Crpe1.Output := toWindow; Crpe1.Execute;

GraphText GroupsTitle property

Declaration

property GroupsTitle: TCrGraphTextType;

Type

TCrGraphTextType = string[128];

Description

The GroupsTitle property specifies the title of the Groups which are being graphed.

VCL Reference

328

Example

The following example retrieves the GraphText information from the Report, then changes the GroupsTitle for the first Graph:

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

if Crpe1.GraphText.Count > 0 then Crpe1.GraphText[0].GroupsTitle := 'New Groups Title';

Crpe1.Output := toWindow; Crpe1.Execute;

GraphText Item property

Declaration

property Item[const nIndex: integer]: TCrpeGraphText;

Description

The Item property is a default array property. It is read-only, and only available at runtime. It's primary use is to provide an easy way to navigate through the various items stored in the GraphText object, allowing the object to be treated like an array.

Item is a default property, so it does not need to be specified when using the subscript: GraphText[2] is the same as GraphText.Item[2].

Item returns a reference to itself, so the GraphText properties can be used right after the subscript: GraphText[2].Title := 'NewGraph';

Example

Since Item is a default array property, the following two blocks of code do the same thing:

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

{Set GraphText object to the 2nd graph} Crpe1.GraphText.Item[1];

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

{Set GraphText object to the 2nd graph} Crpe1.GraphText[1];

VCL Reference

329

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