RMreport的使用技巧
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"'] := '姓名';
這樣在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;
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;
9、自動換行
主項數據欄Stretched = true
文本框 Stretched = true
WordWrap = true
10、RM內置變量(Script),增加中....
a.屬性PrintAtAppendBlank=True
CurReport.AppendBlanking=True時代表增加空行
在RM中,打印設置只能保存頁面邊距及打印份數、是否兩遍打印以及是否套打等參數,缺少保存打印機紙張類型、進紙方式以及紙張頁面大小等信息的保存及引入。詳情可以參見RM_Class.pas代碼的第13776行的保存處代碼以及13706引入代碼。
現在我們修改一下這兩處代碼,我們處理保存到注冊表方式,保存到INI文件方式類似。
將其他信息保存進去
liRegIniFile.WriteInteger(aReportName, 'Page_' + IntToStr(i) + '_PageWidth', aReport.Pages[i].pgWidth);//頁寬
liRegIniFile.WriteInteger(aReportName, 'Page_' + IntToStr(i) + '_PageHeight', aReport.Pages[i].pgHeight);//頁高
liRegIniFile.WriteInteger(aReportName, 'Page_' + IntToStr(i) + '_pgOr', Integer(aReport.Pages[i].pgOr));//方向(橫向或是縱向)
liRegIniFile.WriteInteger(aReportName, 'Page_' + IntToStr(i) + '_pgBin', aReport.Pages[i].pgBin);//進紙方式
liRegIniFile.WriteInteger(aReportName, 'Page_' + IntToStr(i) + '_pgSize', aReport.Pages[i].pgSize);//紙張尺寸(自定義=256)
再修改引入處的代碼:
???? AWidth := liRegIniFile.ReadInteger(aReportName, 'Page_' + IntToStr(i) + '_PageWidth', 0);
???? AHeight := liRegIniFile.ReadInteger(aReportName, 'Page_' + IntToStr(i) + '_PageHeight', 0);
???? AOr???? := liRegIniFile.ReadInteger(aReportName, 'Page_' + IntToStr(i) + '_pgOr', 0);
???? ABin??? := liRegIniFile.ReadInteger(aReportName, 'Page_' + IntToStr(i) + '_pgBin', 0);
???? ASize?? := liRegIniFile.ReadInteger(aReportName, 'Page_' + IntToStr(i) + '_pgSize', 0);
???? aReport.Pages[i].ChangePaper(ASize,AWidth,AHeight,ABin,TPrinterOrientation(AOr));//關鍵,更改頁面信息
?
?
?
var
?? Page: TRMReportPage;
?? Page := TRMReportPage(RMReport1.Pages[0]);
?? Page.ChangePaper();
?
ChangePaper(ASize, AWidth, AHeight,abin: Integer; AOr: TPrinterOrientation);
asize:頁碼紙張的類型,可以通過api從打印驅動中取出例如9是a4,如果系統沒有的紙張類型,她認為是自定義格式
awidth:紙張寬度(MM)
aheight:紙張高度(MM)
AOr:打印方向?? // rmpolangscape 橫向 rmpoPortrait //縱向
ABIN:;//進紙方式
總結
以上是生活随笔為你收集整理的RMreport的使用技巧的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 知了堂|给你一个网站你是如何来渗透测试的
- 下一篇: VM虚拟机仿真网络问题