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

Description

Name specifies the Font Name to be used for the specified Section. The property uses Delphi's TFontName type, which makes a list of installed fonts available on the Object Inspector (or if the property is double-clicked, the Font Dialog will appear).

Example

The code below retrieves the SectionFont settings from the Report, then loops through looking for the Details "a" section, and sets the Font Name and Size for that section:

var

cnt: integer; begin

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

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

{Look for Details area}

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

Crpe1.SectionFont[cnt].Name := 'Times New Roman'; Crpe1.SectionFont[cnt].Size := 10;

end; end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFont Pitch property

Declaration

property Pitch: TFontPitch;

Type

TFontPitch = (fpDefault, fpVariable, fpFixed);

Description

Pitch determines whether the Font character spacing will be Fixed or Variable.

With Fixed Pitch, each character occupies the same width, as on a typewriter.

With Variable Pitch, characters only occupy as much space as is required, so an "i" takes up less space than a "w".

Fixed Pitch is commonly used with numbers, so that the columns line up properly.

VCL Reference

532

Example

The code below retrieves the SectionFont settings from the Report, then loops through looking for the Details "a" section, and sets the Font Name, Size and Pitch for that section:

var

cnt: integer; begin

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

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

{Look for Details area}

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

Crpe1.SectionFont[cnt].Name := 'Times New Roman'; Crpe1.SectionFont[cnt].Size := 10; Crpe1.SectionFont[cnt].Pitch := fpVariable;

end; end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFont Scope property

Declaration

property Scope: TCrFontScope;

Type

TCrFontScope = (Fields, Text, Both);

Description

The Scope property determines what type of Fields the Font changes will apply to: Database Fields, Text Fields, or both.

VCL Reference

533

Example

The code below retrieves the SectionFont settings from the Report, then loops through looking for the Details "a" section, and sets the Font Name, Size, and Scope for that section:

var

cnt: integer; begin

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

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

{Look for Details area}

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

Crpe1.SectionFont[cnt].Name := 'Times New Roman'; Crpe1.SectionFont[cnt].Size := 10; Crpe1.SectionFont[cnt].Scope := Both;

end; end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFont Section property

Declaration

property Section: TCrSectionFontSection;

Type

TCrSectionFontSection = string;

Description

The Section property contains the Section name of the item that the SectionFont object is currently pointed to. It's primary use is as a look-up property to point the SectionFont 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 SectionFont item is automatically filled when the SectionFont information is retrieved.

VCL Reference

534

The Section name syntax is the same as the Short Section Names used in the Crystal Reports Designer as listed 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 SectionFont 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.SectionFont.Retrieve;

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

{Look for Details area}

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

Crpe1.SectionFont[cnt].Name := 'Times New Roman'; Crpe1.SectionFont[cnt].Size := 10; Crpe1.SectionFont[cnt].Scope := Both; Crpe1.SectionFont[cnt].Italic := cTrue; Crpe1.SectionFont[cnt].Weight := fwBold;

end; end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFont SectionAsCode property

Declaration

property SectionAsCode: smallint;

VCL Reference

535

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