Creation of style sets |
Top Previous Next |
The following code shows how to create a styles set, with the addition of two styles to the set. After these operations are completed the styles are applied to the report.
Pascal:
var Style: TfrxStyleItem; Styles: TfrxStyles;
Styles := TfrxStyles.Create(nil);
{ the first style } Style := Styles.Add; Style.Name := 'Style1'; Style.Font.Name := 'Courier New';
{ the second style } Style := Styles.Add; Style.Name := 'Style2'; Style.Font.Name := 'Times New Roman'; Style.Frame.Typ := [ftLeft, ftRight];
{ apply a set to the report } frxReport1.Styles := Styles;
C++:
TfrxStyleItem * Style; TfrxStyles * Styles;
Styles = new TfrxStyles(NULL);
// the first style Style = Styles->Add(); Style->Name = "Style1"; Style->Font->Name = "Courier New";
// the second style Style = Styles->Add(); Style->Name = "Style2"; Style->Font->Name = "Times New Roman"; Style->Frame->Typ << ftLeft << ftRight;
// apply a set to the report frxReport1->Styles = Styles;
The set can be created and used in a different way:
Pascal:
var Style: TfrxStyleItem; Styles: TfrxStyles;
Styles := frxReport1.Styles; Styles.Clear;
{ the first style } Style := Styles.Add; Style.Name := 'Style1'; Style.Font.Name := 'Courier New';
{ the second style } Style := Styles.Add; Style.Name := 'Style2'; Style.Font.Name := 'Times New Roman'; Style.Frame.Typ := [ftLeft, ftRight];
{ apply a set to the report } frxReport1.Styles.Apply;
C++:
TfrxStyleItem * Style; TfrxStyles * Styles;
Styles = frxReport1->Styles; Styles->Clear();
// the first style Style = Styles->Add(); Style->Name = "Style1"; Style->Font->Name = "Courier New";
// the second style Style = Styles->Add(); Style->Name = "Style2"; Style->Font->Name = "Times New Roman"; Style->Frame->Typ << ftLeft << ftRight;
// apply a set to the report frxReport1->Styles->Apply();
|