Creation of style sets
The following code demonstrates processes of creation of styles set, and addition of two styles to a 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;
You can create and use a set 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();