资源描述:
《Delphi程序代码设计报表》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、用程序代码设计报表创建一窗体Forml,unit文件保存为RaveReport.pas,窗体上放置一个RpSystem控件和一个Button,程序代码如下,一个简单的报表就完成了。unitRaveReport;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,Dialogs,RpRenderCanvas,RpRenderPreview,RpRender,RpRenderPDF,RpBase,RpSystem,StdCtr
2、ls,RpDefine,RpRave;typeTForml=class(TForm)Button1:TButton;RvSystem1:TRvSystem;procedureRvSystem1Print(Sender:TObject);procedureButton1Click(Sender:TObject);private{Privatedeclarations}public{Publicdeclarations}end;varForml:TForml;implementation{$RprocedureTFormI.RvSy
3、stem1Print(Sender:TObject);varIl:integer;SI:string[20];S2:string[20];Bitmap:TBitmap;PolyLineArr:array[1..6]ofTPoint;beginwithSenderasTBaseReportdobegin{打印表头和表尾}TheseSectionTop:=0.75;〃设定内容输出区域的顶部位置propertiesreturnorsetthecurrentsectionofthepapertobeprintedon.//Header输
4、出在内容输11!区域的顶部SetFont(味体',10);PrintHeader('第,+IntToStr(CurrentPage)+'页',pjLeft);〃页码Thismethodwillprintthestring,Text,justbelowthecurrentSectionTopjustifiedby,Justify,betweenthecurrentSectionLeftandSectionRight.PrintHeader(*H期:'+DateToStr(Date)+'',pjRight);〃日期Thismetho
5、dwillprintthestring,Text,justbelowthecurrentSectionTopjustifiedby,Justify,betweenthecurrentSectionLeftandSectionRight.SectionBottom:=10.75;〃设定内容输出区域的底部位置Thesepropertiesreturnorsetthecurrentsectionofthepapertobeprintedon.//Footer输出在内容输出区域的底部SetFont('宋体JO);PrintFooter(
6、*第'+IntToStr(CurrentPage)+'页’,pjLeft);〃页码Thismethodwillprintthestring,Text,justabovethecurrentSectionBottomjustifiedby,Justify,betweenthecurrentSectionLeftandSectionRight.PrintFooterC0期:’+DateToStr(Date)+'pjRight);〃日期Thismethodwillprintthestring,Text,justabovethecur
7、rentSectionBottomjustifiedby,Justify,betweenthecurrentSectionLeftandSectionRight.〃输出报告的题目YPos:=1.0;〃垂直方向的位置(从页顶向下的绝对位置,不受内容输出区域范圉的限制,单位缺省为Inch)Thispropertysetsorreturnsthehorizontaltextcursorposition.SetFont(嘿体’,26);〃设置字体Underline:=true;〃下划线FontRotation:=20;〃旋转文字排列走向
8、的角度(按逆时针方向)PrintCenter(^的报表;PageWidth/2);〃在(PageWidth⑵位置居中输出字符串(字符串的水平屮心与(PageWid(h/2)位置相重合)〃文字的下基线作为垂直方向的定位点SetFont('宋体’,10);Under