FastReport VCL报表创建样式集教程
FastReport VCL是用于 Delphi、C++ Builder、RAD Studio 和 Lazarus 的报告和文档创建 VCL 库。它提供了可视化模板设计器,可以访问 30 多种格式,并可以部署到云、网站、电子邮件和打印中。
立即点击下载FastReport VCL v6.9最新版【慧都网】
以下代码演示了创建样式集以及将两种样式添加到集的过程。完成这些操作后,样式将应用于报表。
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;
您可以以不同的方式创建和使用集合:
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();
浙公网安备 33010602011771号