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

SectionFormatFormulas NameCount method

Declaration

function NameCount: integer;

Description

The NameCount property returns the number of Formula Names available for a specific Section. NameCount can be used with the Names property in a looping construct, to step through the Formula Name items.

Comparison of Properties for Section Items and Name Items:

The SectionFormatFormulas object contains an internal Index which determines which Section item it is currently looking at. This index is changed via the Section, Item, and ItemIndex properties, and can be read via the IndexOf method.

Likewise, since each Section contains numerous Formula Name items, these are controlled via a secondary internal Index which is changed via the Name, Names, and NameIndex properties, and can be read via the IndexOfName method.

Sections

Names

 

 

Section

Name

 

 

Item

Names

 

 

ItemIndex

NameIndex

IndexOf

IndexOfName

Count

NameCount

 

 

Example

The Names property is used in the example below, to loop through the Formula items for the Page Header section, sending the Formula names to a ListBox:

var

cnt: integer; begin

Crpe1.ReportName := 'C:\Company.rpt'; Crpe1.AreaFormatFormulas.Retrieve; Crpe1.AreaFormatFormulas.Section := 'PH';

for cnt := 0 to (Crpe1.AreaFormatFormulas.NameCount - 1) do begin

case Ord(Crpe1.AreaFormatFormulas.Names[cnt]) of

0:ListBox1.Items.Add('afHide');

1:ListBox1.Items.Add('afSuppress');

2:ListBox1.Items.Add('afPrintAtBottomOfPage');

VCL Reference

582

3:ListBox1.Items.Add('afNewPageBefore');

4:ListBox1.Items.Add('afNewPageAfter');

5:ListBox1.Items.Add('afResetPageNAfter');

6:ListBox1.Items.Add('afKeepTogether');

end;

end; end;

SectionFormatFormulas Retrieve method

Declaration

function Retrieve: boolean;

Description

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

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

VCL Reference

583

Crpe1.SectionFormatFormulas.Retrieve; end;

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

end;

SectionFormatFormulas SectionType method

Declaration

property 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 GH1a, 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.

Example

The following example uses the SectionType method to apply conditional formatting. The formatting is to apply to all Group Header sections, so the SectionType method can be used in an expression to apply the changes:

var

cnt: integer; begin

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

Crpe1.SectionFormatFormulas.Retrieve;

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

{if the SectionType is Group Header, apply the change}

if (Crpe1.SectionFormatFormulas[cnt].SectionType = 'GH') then begin

Crpe1.SectionFormatFormulas[cnt].Name := sfSuppress; Crpe1.SectionFormatFormulas[cnt].Formula.Text := '{company.STATE}

= "CA"'; end;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

VCL Reference

584

SectionFormatFormulas Send method

Declaration

function Send: boolean;

Description

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

Crpe1.SectionFormatFormulas.Send;

SectionHeight Properties

SectionHeight Height property

Declaration

property Height: smallint;

Description

Height determines the height of the specified Section in twips.

There are 1440 twips to an inch.

There are 20 twips to a point.

There are 72 points to an inch.

Conversion Formulas:

Twips = Inches * 1440

Inches = Twips / 1440

VCL Reference

585

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