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

SectionFormat Retrieve method, Page 562

SectionFormat SectionType method, Page 563

SectionFormat Send method, Page 564

SectionFormatFormulas

Declaration

property SectionFormatFormulas: TCrpeSectionFormatFormulas;

Type

TCrpeSectionFormatFormulas = class(TPersistent)

Description

SectionFormatFormulas encapsulates the formula control over Section Formatting that is available in the Format Section dialog of Crystal Reports designer.

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 Name property specifies which Format option the SectionFormatFormula will act on. Names, NameCount, IndexOfName and NameIndex can also be used to manipulate the Formula names list.

The Section property specifies which section of the Report that the formula will apply to.

The Retrieve method will obtain the SectionFormatFormula information from the Report.

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

The Item and ItemIndex properties can be used to navigate through the different Section items in the SectionFormatFormulas object.

The Add and Delete methods can be used instead of Retrieve/Clear, to manually add items to the SectionFormatFormulas object.

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

VCL Reference

96

Limitations

SectionFormatFormulas has similar limitations to SectionFormat:

Main Report - For Page Header (PH) and Page Footer (PF) sections, the following Formula names do not apply:

¾sfKeepTogether

¾sfNewPageAfter

¾sfNewPageBefore

¾sfPrintAtBottomOfPage

Subreports - For Report Header b (RHb) and Report Footer b (RFb) sections, the following Formula names do not apply:

¾sfKeepTogether

¾sfNewPageAfter

¾sfNewPageBefore

¾sfPrintAtBottomOfPage

Attempting to set Formulas for non-applicable Sections will cause errors when the Report is run.

SectionFormatFormulas Example

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

Crpe1.ReportName := 'Company.rpt'; Crpe1.SectionFormatFormulas.Retrieve; {Loop through the Areas}

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

{Check for Details area}

if Crpe1.SectionFormatFormulas[cnt].Section = 'Da' then begin

{Choose the Suppress formula} Crpe1.SectionFormatFormulas[cnt].Name := sfSuppress; {Clear it from any retrieved formula} Crpe1.SectionFormatFormulas[cnt].Formula.Clear;

{Add the new formula} Crpe1.SectionFormatFormulas[cnt].Formula.Add('{company.STATE}

= "CA"'); Break;

end; end;

Crpe1.Output := toWindow; Crpe1.Execute;

VCL Reference

97

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