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

Type

TCrSectionHeightSection = string;

Description

The Add method adds an item to the SectionHeight 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 SectionHeight are:

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

2Fill the Height property with a value.

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 SectionHeight object, instead of using Retrieve:

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

{Specify Section Name - must be same as in Report} Crpe1.SectionHeight.Add('PH'); Crpe1.SectionHeight.Height := 500;

Crpe1.Output := toWindow; Crpe1.Execute;

SectionHeight Clear method

Declaration

procedure Clear;

Description

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

VCL Reference

590

Example

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

Crpe1.SectionHeight.Clear;

This code clears the SectionHeight properties for all the Subreports:

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

Crpe1.Subreports[cnt];

Crpe1.SectionHeight.Clear; end;

SectionHeight CopyFrom method

Declaration

function CopyFrom(Source: TCrpeSectionHeight): boolean;

Description

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

var

tempSectionHeight : TCrpeSectionHeight; begin

tempSectionHeight := TCrpeSectionHeight.Create; tempSectionHeight.CopyFrom(Crpe1.SectionHeight); {...later, when finished with the temp object...} tempSectionHeight.Free;

end;

SectionHeight Count method

Declaration

function Count: integer;

VCL Reference

591

Description

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

for cnt := 0 to (Crpe1.SectionHeight.Count - 1) do Crpe1.SectionHeight[cnt].Height := 500;

end;

SectionHeight Create method

Declaration

constructor Create;

Description

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

SectionHeight Delete method

Declaration

procedure Delete(nIndex: integer);

Description

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

VCL Reference

592

Example

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

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

{Specify Section Name - must be same as in Report} Crpe1.SectionHeight.Add('PH'); Crpe1.SectionHeight.Height := 500;

Crpe1.Output := toWindow; Crpe1.Execute; Crpe1.SectionHeight.Delete(0);

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

NOTE: The TCrpe component is responsible for creating and freeing all of the sub-classes that belong to it. The only time you would want to be concerned with doing this is if you are creating a temporary object to store data from the TCrpe using the CopyFrom method that is available from the sub-class or the CopyFrom method that is available from the main TCrpe class.

SectionHeight Retrieve method

Declaration

function Retrieve: boolean;

Description

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

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

VCL Reference

593

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