Lazarus 中使用Grid++Report报表控件 的简单例子
来源:互联网 发布:mac下安装nodejs 编辑:程序博客网 时间:2024/05/16 10:56
Grid++Report安装到Lazarus后,Grid++Report的查询显示器,打印预览器,报表主对象和报表设计器的的相关命令要通过OleServer来具体调用。除此之外,使用方法与在Delphi中没有区别。
如:
AxcGridppReport1.OleServer.LoadFromFile('d:\1.grf'); //读入一个报表模板 ,中间加了OleServer
Form1的lfm文件:
object Form1: TForm1 Left = 234 Height = 421 Top = 134 Width = 633 Caption = 'Form1' ClientHeight = 421 ClientWidth = 633 OnShow = FormShow LCLVersion = '1.0.10.0' WindowState = wsMaximized object AxcGRDisplayViewer1: TAxcGRDisplayViewer Left = 0 Height = 365 Top = 56 Width = 633 Align = alClient AutoSize = True TabOrder = 0 UseDockManager = False Active = False OnContentCellDblClick = AxcGRDisplayViewer1ContentCellDblClick end object AxcGridppReport1: TAxcGridppReport Left = 200 Height = 24 Top = 8 Width = 24 TabOrder = 1 UseDockManager = False Active = False OnExportEnd = AxcGridppReport1ExportEnd end object Panel1: TPanel Left = 0 Height = 56 Top = 0 Width = 633 Align = alTop ClientHeight = 56 ClientWidth = 633 TabOrder = 2 object Button1: TButton Left = 24 Height = 25 Top = 8 Width = 115 Caption = '展示报表' OnClick = Button1Click TabOrder = 0 end object Button2: TButton Left = 160 Height = 25 Top = 8 Width = 107 Caption = '设计报表' TabOrder = 1 Visible = False end endend
Unit单元文件:
unit Unit1;{$mode objfpc}{$H+}interfaceuses Classes, SysUtils, FileUtil, grproLib_5_0_TLB, RTTICtrls, RTTIGrids, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls;type { TForm1 } TForm1 = class(TForm) AxcGRDisplayViewer1: TAxcGRDisplayViewer; AxcGridppReport1: TAxcGridppReport; Button1: TButton; Button2: TButton; Panel1: TPanel; procedure AxcGRDisplayViewer1ContentCellDblClick(Sender: TObject; pSender: IGRColumnContentCell); procedure AxcGridppReport1ExportEnd(Sender: TObject; pOptionObject: IGRExportOption); procedure Button1Click(Sender: TObject); procedure FormShow(Sender: TObject); private { private declarations } public { public declarations } end;var Form1: TForm1;implementation{$R *.lfm}{ TForm1 }procedure TForm1.FormShow(Sender: TObject);begin AxcGRDisplayViewer1.Active:=true; //激活报表COM组件,带有界面的Com组件要执行本命令才会显示在Form中end;procedure TForm1.AxcGridppReport1ExportEnd(Sender: TObject; pOptionObject: IGRExportOption);begin self.Caption:='导出数据成功'; //测试主报表事件是否生效end;procedure TForm1.AxcGRDisplayViewer1ContentCellDblClick(Sender: TObject; pSender: IGRColumnContentCell);begin ShowMessage(pSender.DataField); //报表查询显示器内容格双击事件中取出内容格关联的字段名称end;procedure TForm1.Button1Click(Sender: TObject);begin if AxcGRDisplayViewer1.OleServer.Running then AxcGRDisplayViewer1.OleServer.Stop; AxcGRDisplayViewer1.OleServer.ShowToolbar:=true; //显示报表工具条 AxcGridppReport1.OleServer.LoadFromFile('d:\1.grf'); //读入一个报表模板 AxcGRDisplayViewer1.OleServer.Report := AxcGridppReport1.OleServer;//报表关联到AxcGRDisplayViewe(查询显示器控件) AxcGRDisplayViewer1.OleServer.Start; //启动报表end;end.
附一个运行效果图片:
- Lazarus 中使用Grid++Report报表控件 的简单例子
- Lazarus 中安装Grid++Report报表控件
- UniGui中使用Grid++Report报表控件子报表获取数据的方法
- 使用报表grid++report
- uniGUI中使用Grid++Report设计报表
- 再议UniGui中使用Grid+Report报表控件(推荐此方法)
- Grid++Report 报表动态使用
- grid+report简单使用
- 使用Grid++report开发报表功能
- Grid++Report报表组件的特点
- grid++report子报表
- QX Grid Report Designer(强新报表开发软件)使用教程
- Grid++Report 报表设计器
- Grid++Report实现Web报表
- grid report分组打印报表
- 关于Lazarus下PowerPDF控件的使用
- VB中使用Grid++报表
- Lazarus 使用KbmMemTable控件
- 《算法竞赛-训练指南》第一章-1.24_pre-一维数组最大连续和
- 搞acm的,,,,,,
- acm教主系列
- gethostbyname
- UVA 216 Getting in Line
- Lazarus 中使用Grid++Report报表控件 的简单例子
- Linux多线程
- 6174问题
- ios开发代码笔记
- 扩展RBAC用户角色权限设计方案
- Stars
- Innode引擎监控的开启的方法
- 贝塞尔曲线移动 应用
- 软件工程之软件测试