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

Type

TCrGraphOptionsNumber = integer;

Description

The Add method adds an item to the GraphOptions object and sets the internal index to that item. It requires a Graph number as a parameter, which should be a number corresponding to a Graph in the Report. Graphs are numbered starting from zero, from the top of the Report down, and left to right in each Section. If the Add method is used, the steps to using GraphOptions are:

1Add an item to the GraphOptions object (you must specify the Graph number).

2Fill the item's properties (BarDirection, DataValues, etc.) with values.

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 Graph numbers are correct for the current Report.

Example

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

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

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

{Section must also be specified when using Add} Crpe1.GraphOptions.Section := 'PH'; Crpe1.GraphOptions.Font := 'Times New Roman'; Crpe1.Output := toWindow;

Crpe1.Execute;

GraphOptions Clear method

Declaration

procedure Clear;

Description

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

VCL Reference

322

Example

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

Crpe1.GraphOptions.Clear;

This code clears the GraphOptions properties for all the Subreports:

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

Crpe1.Subreports[cnt];

Crpe1.GraphOptions.Clear; end;

GraphOptions CopyFrom method

Declaration

function CopyFrom(Source: TCrpeGraphOptions): boolean;

Description

The CopyFrom method copies the GraphOptions property values from another TCrpeGraphOptions 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 GraphOptions property values to a temporary TCrpeGraphOptions object:

var

tempGraphOptions : TCrpeGraphOptions; begin

tempGraphOptions := TCrpeGraphOptions.Create; tempGraphOptions.CopyFrom(Crpe1.GraphOptions); {...later, when finished with the temp object...} tempGraphOptions.Free;

end;

VCL Reference

323

GraphOptions Count method

Declaration

function Count: integer;

Description

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

for cnt := 0 to (Crpe1.GraphOptions.Count - 1) do Crpe1.GraphOptions[cnt].GridLines := cTrue;

end;

GraphOptions Create method

Declaration

constructor Create;

Description

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

GraphOptions Delete method

Declaration

procedure Delete(nIndex: integer);

Description

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

VCL Reference

324

Example

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

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

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

{Section must also be specified when using Add} Crpe1.GraphOptions.Section := 'PH'; Crpe1.GraphOptions.Font := 'Times New Roman'; Crpe1.Output := toWindow;

Crpe1.Execute;

Crpe1.GraphOptions.Delete(0);

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

GraphOptions Retrieve method

Declaration

function Retrieve: boolean;

Description

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

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

VCL Reference

325

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