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

AreaFormat Methods

AreaFormat Add method, Page 223

AreaFormat Clear method, Page 224

AreaFormat CopyFrom method, Page 225

AreaFormat Count method, Page 225

AreaFormat Create method, Page 226

Area Format Delete method, Page 226

AreaFormat Destroy method, Page 226

AreaFormat Retrieve method, Page 227

AreaFormat SectionType method, Page 228

AreaFormat Send method, Page 228

AreaFormatFormulas

Declaration

property AreaFormatFormulas: TCrpeAreaFormatFormulas;

Type

TCrpeAreaFormatFormulas = class(TPersistent)

Description

The AreaFormatFormulas object can be used to specify formulas that control the AreaFormat options. In Crystal Reports Designer, these formulas are found in the Formula buttons that appear beside each option in the Section Format dialog box. AreaFormatFormulas apply formula control to the general areas of a report (Report Header, Group Header 1, Details, etc.), whereas SectionFormatFormulas apply formula control to the specific sections (Report Header a, Group Header 2b, Details c, etc.).

The Section naming format has been adopted from the Crystal Reports "short" section naming convention, so RH means ReportHeader, GH3 means GroupHeader 3, etc. See About Section Names, Volume 1, Chapter 7, for more information.

The Section property specifies which report area the AreaFormatFormulas will apply to.

The Name property specifies which formatting option the AreaFormatFormulas will apply to.

The Formula property specifies the text of the Formula that is being applied.

The Retrieve method can be used to get the AreaFormatFormulas information from the report.

If the manual Add method is used instead, the programmer will have to specify which section to add to the AreaFormatFormulas object.

VCL Reference

10

The Count method returns the number of items currently contained in the AreaFormatFormulas object.

The Item, and ItemIndex properties can be used to navigate through the different section items in the AreaFormat object.

The IndexOf method will return the internal index number of the AreaFormatFormulas item that has a Section name which matches the specified value.

The SectionAsCode property offers the ability to treat the Section name as a Section Code Number, which can be useful for doing mathematical expressions to filter out certain sections.

The SectionType method returns just the first characters of the Section name, so for GH1 (Group Header 1), the SectionType would be GH (Group Header).

The Names property can be used to navigate through the individual formulas available for a specified section.

The NameCount method can be used to set the subscript bounds when looping through the Names property. IndexOfName and NameIndex are also useful in locating a specific Formula name within a given AreaFormatFormulas item.

Limitations

AreaFormatFormulas has certain limitations similar to those of AreaFormat:

For Report Header (RH) areas, the afNewPageBefore formula does not apply.

For Report Footer (RF) areas, the afNewPageAfter formula does not apply. For Page Header (PH) and Page Footer (PF) areas, the following formulas do not apply:

afHide afKeepTogether afNewPageAfter afNewPageBefore afPrintAtBottomOfPage

Attempting to assign values to the formulas for these areas will cause errors when the Report is run.

AreaFormatFormulas Example

This example retrieves the AreaFormatFormula information, then assigns a Suppress formula to the Details area, so that the Details area will be suppressed if the State is California:

Crpe1.ReportName := 'Company.rpt';

Crpe1.AreaFormatFormulas.Retrieve; {Loop through the Areas}

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

{Check for Details area}

if Crpe1.AreaFormatFormulas[cnt].Section = 'D' then

VCL Reference

11

begin

{Choose the Suppress formula} Crpe1.AreaFormatFormulas[cnt].Name := afSuppress; {Clear it from any previous formula} Crpe1.AreaFormatFormulas[cnt].Formula.Clear;

{Add the new formula} Crpe1.AreaFormatFormulas[cnt].Formula.Add('{company.STATE} = "CA"'); Break;

end; end;

Crpe1.Execute;

AreaFormatFormulas Properties

AreaFormatFormulas Formula property, Page 229

AreaFormatFormulas Item property, Page 230

AreaFormatFormulas ItemIndex property, Page 231

AreaFormatFormulas Name property, Page 231

AreaFormatFormulas NameIndex Property, Page 234

AreaFormatFormulas Names Property, Page 235

AreaFormatFormulas Section property:, Page 235

AreaFormatFormulas SectionAsCode property, Page 237

AreaFormatFormulas Methods

AreaFormatFormulas Add method, Page 238

AreaFormatFormulas Check method, Page 239

AreaFormatFormulas Clear method, Page 239

AreaFormatFormulas CopyFrom method, Page 240

AreaFormatFormulas Count method, Page 240

AreaFormatFormulas Create method, Page 241

AreaFormatFormulas Delete method, Page 241

AreaFormatFormulas Destroy method, Page 242

AreaFormatFormulas IndexOf method, Page 242

VCL Reference

12

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