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

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 CharSet 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].CharSet := fcDefault;

end; end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFont Family property

Declaration

property Family: TCrFontFamily;

Type

TCrFontFamily = (ffDefault, ffRoman, ffSwiss, ffModern, ffScript, ffDecorative);

Description

The Family property specifies the Font Family that is used for the Font in the specified Section. Use ffDefault for no change.

VCL Reference

528

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 Family 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].Family := ffDefault;

end; end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFont Italic property

Declaration

property Italic: TCrBoolean;

Type

TCrBoolean = (cFalse, cTrue, cDefault);

Description

The Italic property determines whether the Font should be italicized. Use cDefault for no change.

VCL Reference

529

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 Italic properties 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].Italic := cTrue;

end; end;

Crpe1.Output := toWindow; Crpe1.Execute;

end;

SectionFont Item property

Declaration

property Item[const nIndex: integer]: TCrpeSectionFont;

Description

The Item property is a default array property. It is read-only, and only available at runtime. It's primary use is to provide an easy way to navigate through the various items stored in the SectionFont object, allowing the object to be treated like an array.

Item is a default property, so it does not need to be specified when using the subscript: SectionFont[2] is the same as SectionFont.Item[2].

Item returns a reference to itself, so the SectionFont properties can be used right after the subscript: SectionFont[2].Name := 'Times New Roman';

VCL Reference

530

Example

Since Item is a default array property, the following two blocks of code do the same thing:

Crpe1.ReportName := 'MyReport.rpt'; Crpe1.SectionFont.Retrieve;

{Set SectionFont object to the 3rd section} Crpe1.SectionFont.Item[2];

Crpe1.ReportName := 'MyReport.rpt'; Crpe1.SectionFont.Retrieve;

{Set SectionFont object to the 3rd section} Crpe1.SectionFont[2];

SectionFont ItemIndex property

Declaration

property ItemIndex: integer;

Description

ItemIndex is a Run-time only property which can be used to obtain the current SectionFont item number, or set the SectionFont object to another item.

Each object in the Crystal component that can contain more than one item uses an internal Index to maintain which item it is currently looking at, similar to the ItemIndex property of a ListBox. This Index is updated whenever the Item property is used (SectionFont[2], for example), or whenever the key property (if applicable) is assigned a new lookup value (key properties are things like Formulas.Name, or SortFields.Number which serve as look-up properties).

The easiest way to read the current Index number is to use the ItemIndex property.

Example

The following code illustrates the use of the ItemIndex property to make sure the SectionFont object is pointing to the first SectionFont item:

if Crpe1.SectionFont.ItemIndex <> 0 then Crpe1.SectionFont[0];

SectionFont Name property

Declaration

property Name: TFontName;

VCL Reference

531

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