Modifying/adding/deleting a style

Top  Previous  Next

Modifying a style with a given name:

 

Pascal:

 

var

 Style: TfrxStyleItem;

 Styles: TfrxStyles;

 

Styles := frxReport1.Styles;

 

{ search for a style}

Style := Styles.Find('Style1');

 

{ modify the font size }

Style.Font.Size := 12;

 

C++:

 

TfrxStyleItem * Style;

TfrxStyles * Styles;

 

Styles = frxReport1->Styles;

 

// search for a style

Style = Styles->Find("Style1");

 

// modify the font size

Style->Font->Size = 12;

 

Adding a style to the report styles set:

 

Pascal:

 

var

 Style: TfrxStyleItem;

 Styles: TfrxStyles;

 

Styles := frxReport1.Styles;

 

{ add }

Style := Styles.Add;

Style.Name := 'Style3';

 

C++:

 

TfrxStyleItem * Style;

TfrxStyles * Styles;

 

Styles = frxReport1->Styles;

 

// add

Style = Styles->Add();

Style->Name = "Style3";

 

Deleting a style with a given name:

 

Pascal:

 

var

 Style: TfrxStyleItem;

 Styles: TfrxStyles;

 

Styles := frxReport1.Styles;

 

{ delete }

Style := Styles.Find('Style3');

Style.Free;

 

C++:

 

TfrxStyleItem * Style;

TfrxStyles * Styles;

 

Styles = frxReport1->Styles;

 

// delete

Style = Styles->Find("Style3");

delete Style;

 

After modification the “Apply” method should be called:

 

{ use modifications }

frxReport1.Styles.Apply;