1、不打印特定的MemoView,套打常用 a.页面设置-->其它-->不打印背景图 b.设置MemoView属性printable=False 2、 如何打印wwDBGrid? 修改rm.inc,如果想支持RX,GIF,JPEG,DimandAccess,Halcyon,DBISAM, EHLib,也需要修改rm.inc //{$DEFINE InfoPower} //修改这行,去掉"//" //{$Ehlib} 3.试用版安装方法(以下假设将文件释放到c:\rm目录中) (1)Tools->Environments Option->Libary->Libary Path中增加: c:\rm\souce c:\rm\bpl $(DELPHI)\Lib $(DELPHI)\Bin $(DELPHI)\Imports $(DELPHI)\Projects\Bpl (2)Component->Install Packages->Add,选bpl\rm_d70.bpl 4.在Delphi IDE中卸载以前的Report Machine版本,然后打开rm_r50.dpk,选"compile", 在打开rm_d50.dpk,选"Install". 包分成了Runtime package和Designer package,所以要安装顺序安装 5、单元格的变量格式用代码设置 t = TRMGridReportPage(RMGridReport1.Pages[0]).Grid.Cells[1, 1].View t = TRMMemoView(RMReport1.FindObject('memo1')); t.DisplayFormat := 'N0.001' //数字型 t.DisplayFormat := 'Dyyyy/mm/dd' //日期型 6、两遍报表如何用代码设置 GridReport1.DoublePass := True 7、用代码写数据字典: RMReport1.Dictionary.FieldAliases.Clear; RMReport1.Dictionary.FieldAliases['RMDBDataSet1'] := '动物'; RMReport1.Dictionary.FieldAliases['RMDBDataSet1."Name"'] := '姓名'; RMGridReport1.Dictionary.FieldAliases['RMDBDataSet1."Weight"'] := ''; // 不显示 这样在RM的设计器显示为自定义名称,为最终用户提供友好的显示 8、在报表中如何使用变量(或者如何给某个memoview赋值) a.RMVariables在RM_Class.pas中定义,是全局变量,这样定义后就可以在报表中使用变量"var1",例如: RMVariables['变量名称'] := Edit1.Text; b.用报表中数据字典,TRMReport.Dictionary.Variables,需要注意的是,如果变量是字符型的需要用AsString赋值,其他类型的用RMReport.Dictionary.Variables['var1'] := 1234,例如: RMReport1.LoadFromFile('1.rls'); RMReport1.Dictionary.Variables.AsString['变量名称'] := Edit1.Text; RMReport1.Dictionary.Variables[' 大类1'] := ''; RMReport1.Dictionary.Variables['名称1'] := ''; RMReport1.Dictionary.Variables['名称2'] := ''; RMReport1.Dictionary.Variables[' 大类2'] := ''; RMReport1.Dictionary.Variables['名称3'] := ''; c. 直接对某个单元格赋值,例如: RMGridReport1.LoadFromFile('1.rls'); TRMGridReportPage(RMGridReport1.Pages[0]).Grid.Cells[1,1].Text := '值'; 如果是RMReport: RMReport1.LoadFromFile('1.rmf'); t := RMReport1.FindObject('Memo1'); if t nil then // var t: TRMView t.Memo.Text := 'dsdsdsds'; d.脚本中直接引用Form的值 procedure Main; begin Memo1.Memo.Text := Form1.Edit1.Text; end; 报表脚本例子: unit Report; interface procedure Memo1OnBeforePrint(Sender: TObject); implementation procedure Memo1OnBeforePrint(Sender: TObject); begin Memo1.Text := 'test'; end; procedure Main; begin end; end.
9、自动换行 主项数据栏Stretched = true 文本框 Stretched = true WordWrap = true 10、RM内置变量(Script),增加中.... a.属性PrintAtAppendBlank=True CurReport.AppendBlanking=True时代表增加空行 11、自定义纸张 var Page : TRMReportPage; Page := TRMReportPage(RMReport1.Pages[0]); Page.ChangePaper(ASize, AWidth, AHeight, ABin, AOr); ASize :纸张类型,256为自定义 AWidth: 宽度 AHeight:高度 AOr:方向 ABin:进纸方式 aOr:rmpoPortrait, rmpoLandscape 在RM_Common中定义 aBin: $FFFF // 默认进纸器 12、动态增加数据集: with TRMDBDataSet.Create(self) do begin Name := 'Test1'; DataSet := ADOTable1; RMReport1.Dictionary.FieldAliases[Name] := '测试数据集'; RMReport1.Dictionary.FieldAliases[Name+'."au_id"'] := '自动编号'; end; RMReport1.DesignReport; Uses RM_Dataset; 13、加载界面语言 RMResourceManager.LoadResourceModule('RM_ChiBIG5.dll');
|