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

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

{Look for Details "a" section}

if Crpe1.SectionFormat[cnt].Section = 'Da' then Crpe1.SectionFormat[cnt].NewPageBefore := cTrue;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFormat PrintAtBottomOfPage property

Declaration

property PrintAtBottomOfPage: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

PrintAtBottomOfPage determines if the specified Section will appear at the bottom of the page when the Report is run.

Example

The code below retrieves the SectionFormat settings from the Report, then loops through looking for the Details "a" section, and sets the PrintAtBottomOfPage option for that section:

var

cnt: integer; begin

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

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

{Look for Details "a" section}

if Crpe1.SectionFormat[cnt].Section = 'Da' then Crpe1.SectionFormat[cnt].PrintAtBottomOfPage := cTrue;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

VCL Reference

552

SectionFormat ResetPageNAfter property

Declaration

property ResetPageNAfter: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

ResetPageNAfter determines if the Page Number will be reset back to 1 after the specified Section.

Example

The code below retrieves the SectionFormat settings from the Report, then loops through looking for the Details "a" section, and sets the ResetPageNAfter option for that section:

var

cnt: integer; begin

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

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

{Look for Details "a" section}

if Crpe1.SectionFormat[cnt].Section = 'Da' then Crpe1.SectionFormat[cnt].ResetPageNAfter := cTrue;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFormat Section property

Declaration

property Section: TCrSectionFormatSection;

Type

TCrSectionFormatSection = string;

VCL Reference

553

Description

The Section property contains the Section name of the item that the SectionFormat object is currently pointed to. Its primary use is as a look-up property to point the SectionFormat object to the item with the Section specified. The default array property, Item, however, provides an easier way to navigate through the object.

If the Retrieve method is used, the Section name of each SectionFormat item is automatically filled when the SectionFormat information is retrieved.

The Section name syntax is the same as the Short Section Names used in the Crystal Reports Designer as outlined in the following table. In addition, lower-case letters: a, b, c, etc. are used to specify sub-sections and numbers are used to designate different Groups: GH1, GF2, etc. See About Section Names, Volume 1, Chapter 7, for more details on the syntax.

RH

Report Header

 

 

PH

Page Header

 

 

GH

Group Header

D

Details

 

 

GF

Group Footer

 

 

PF

Page Footer

 

 

RF

Report Footer

Example

The code below retrieves the SectionFormat settings from the Report, then loops through looking for the Details "a" section, and sets various options for that section:

var

cnt: integer; begin

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

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

{Look for Details "a" section}

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

Crpe1.SectionFormat[cnt].BackgroundColor := clRed; Crpe1.SectionFormat[cnt].FreeFormPlacement := cTrue; Crpe1.SectionFormat[cnt].KeepTogether := cTrue; Crpe1.SectionFormat[cnt].NewPageAfter := cFalse; Crpe1.SectionFormat[cnt].NewPageBefore := cFalse; Crpe1.SectionFormat[cnt].PrintAtBottomOfPage := cDefault; Crpe1.SectionFormat[cnt].ResetPageNAfter := cFalse; Crpe1.SectionFormat[cnt].Suppress := cTrue; Crpe1.SectionFormat[cnt].SuppressBlankSection := cTrue;

VCL Reference

554

Crpe1.SectionFormat[cnt].UnderlaySection := cDefault; end;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFormat Suppress property

Declaration

property Suppress: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

Suppress determines if a Section will appear or not when the Report is run. A Section which is suppressed can not be drilled down into. To have a section hidden, but still allow drill-down, use the Hide property of the AreaFormat object.

Example

The code below retrieves the SectionFormat settings from the Report, then loops through looking for the Details "a" section, and sets the Suppress option for that section:

var

cnt: integer; begin

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

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

{Look for Details "a" section}

if Crpe1.SectionFormat[cnt].Section = 'Da' then Crpe1.SectionFormat[cnt].Suppress := cTrue;

end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

VCL Reference

555

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