Use RAVE report in Delphi 7 (4)
- Using the program design a report
The previous article introduced the process of establishing a simple report. This article introduces you the Rave Report Code Programming Example. Place the component on the form: rvsystem, button.
The specific code is as follows: ##################################################################################################################################################################################################################################################################################### ############################# Unit1;
Interface
Uses
Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, stdctrls, rpdefine, rpbase, rpsystem
Type
TFORM1 = Class (TFORM)
Rvsystem1: trvsystem;
Button1: tbutton;
Procedure Rvsystem1Print (Sender: TOBJECT);
Procedure Button1Click (Sender: TOBJECT);
Private
{Private Declarations}
public
{Public declarations}
END;
VAR
FORM1: TFORM1;
IMPLEMentation
{$ R * .dfm}
Procedure TFORM1.RVSYSTEM1PRINT (Sender: TOBJECT);
VAR
I1: integer;
S1: String [20];
S2: String [20];
Bitmap: tbitmap;
POLYLINEARR: Array [1..6] of tpoint;
Begin
With sender as tbasreport do begin
{Printhead head and tail tail}
SectionTop: = 0.75; // Top setFont ('black body', 26); // set font underline: = true; // Underline Home; YPOS: = 1.0; fontrotation: = 20; // Rotate angle printceter ('I Report ', PageWidth / 2); setFont (' Song Body ', 10); sectionBottom: = 10.75; Printfooter (' inTStr (currentpage) 'page', pjleft); / / Page PrintFooter ('Date:' DateTostr (Date) '', PJRight); // Date Sectionbottom: = 10.5; YPOS: = 1.5; SetFont ('Song Body', 12); Settopofpage; Home; {Print column title} cleartabs; setpen (CLBLACK, PSSOLID) , 1, pmcopy; {Setting the brush as a point width} settab (0.5, Pjcenter, 3.5, 0, BoxlineAll, 0); Settab (Na, Pjcenter, 1.0, 0, BoxlineAll, 0); Settab (Na, Pjcenter, 1.5, 0, BoxlineAll, 0); Settab (Na, Pjcenter, 1.5, 0, BoxlineAll, 0); bold: = true; Tab (-2, na, -2, -2, na); {Picture with thick Border of the table} Print ('Name'); Tab (Na, Na, -2, -2, Na); Print ('Number'); Tab (Na, Na, -2, -2, Na); Print 'Amount 1'); Tab (Na, -2, -2, -2, Na); Println ('Amount 2'); bold: = false; {Printing data with border} CleartAbs; settab (0.5, pjleft, 3.5, 2, Boxl INEAll, 0); Settab (Na, Pjcenter, 1.0, 2, BoxlineAll, 0); Settab (Na, PJRight, 1.5, 2, BoxlineAll, 10); Settab (Na, PJRight, 1.5, 2, BoxlineAll, 0); For i1: = 1 to 10 do begin STR (i1 * 1.23: 2: 2, s1); STR (I1 * 98.76: 2: 2, S2); Print (# 9'lastname ' INTOSTR (I1) ', '); Setfont (' Times New Roman ', 8); Print (' firstname m. '); setFont (' Times New Roman ', 12); Println (# 9 INTTOSTR (I1) # 9' $ ' S1 # 9 '$' S2); End; {for} {Print Data with Shadow;
Settab (0.5, Pjleft, 3.5, 2, Boxlinenone, 0); Settab (Na, Pjcenter, 1.0, 2, Boxlinenone, 0); Settab (Na, PJRight, 1.5, 2, Boxlinenone, 0); SetTab (Na, PJRight , 1.5, 2, BoxLinenone, 0); for i1: = 11 to 20 do begin if odd (i1) THEN BEGIN TABSHADE: = 0; Else Begin Tabshade: = 15; End; {Else} Str (i1 * 1.23: 2: 2, S1); STR (I1 * 98.76: 2: 2, S2); Print (# 9'lastname ' INTOSTR (I1) ', '); setFont (' Times New Roman ', 8); Print ('Firstname m.'); setFont ('Times New Roman', 12); Println (# 9 I1) # 9 '$' S1 # 9 '$' S2); End; {for } Cleartabs; {column report} cleartabs; settopofpage; sectionbottom: = 8.0; home; setfont ('Song body', 12); bold: = true; underline: = true; print (LineSleft / ColumnLinesLesleft / Linenum / Columnnnum) '); settopofpage; {set top of page to current ypos} bold: = false; underline: = false; italic: = false; Home; {goto home position} setColumn s (4, 0.5); {Create 4 Column with 0.5 "Between Each} While ColumnLinesleft> 0 Do Begin Print '/' INTOSTR (ColumnLinesLesleft) '/' INTOSTR (LINENUM) '/ ' INTOSTR (ColumnNUM)); End; {while} {Have Border Retriever Report} Cleartabs; Settopofpage; SectionBottom: = 10.5; Home; SetFont (' Times New Roman ', 12); bold: = true; italic: = True; PRINT ('Boxed Column'); Settopofpage; {Set Top of Page to Current Ypos} bold: = FALSE
Italic: = false; Home; {goto home position} cleartabs; setpen (CLBLACK, PSSOLID, 1, PMCopy); Settab (0.5, Pjcenter, 0.375, 0, BoxlineAll, 0); Settab (Na, Pjcenter, 0.375, 0, 0, BoxlineAll, 0); Settab (Na, Pjcenter, 0.375, 0, BoxlineAll, 0); Settab (Na, PjCenter, 0.375, 0, BoxlineAll, 0); SetColumns (4, 0.5); {Create 4 Columns with 0.5 "Between Each} while columnLinesLesleft> 0 do beg linenum = 1 dam tabshade: = 15; println (# 9'll '# 9'cll' # 9'l # '# 9'c #'); {Print Title Bar} END Else Begin Tabshade: = 0; Println (# 9 INTOSTR (LINESLEFT) # 9 INTSTR (LINENUM) # 9 INTOSTR (ColumnNUM)); End; {else} end; While} setColumns (1,0); {Draw text in the specified location} newpage; Originx: = 0.0; {set Origin to Normal} Originy: = 0.0; gotoxy (1.0, 1.0); print ('text @ 1.0, 1.5 '); Gotoxy (6.0, 1.5); Println (' Text @ 6.0, 1.5 '); Gotoxy (2.0, 2.0); Println (' Text @ 2.0, 2.0 '); GOT OXY (3.0, 2.5); Println ('Text @ 3.0, 2.5'); {*** graphic image ***} newpage; resetsection; setfont ('arial', 24); underline: = true; home; printcenter 'Graphics Page Demo', PageWidth / 2); SetFont ( 'Times New Roman', 8); SectionBottom: = 10.75; {Temporarily move the section bottom down} PrintFooter ( 'Page' IntToStr (CurrentPage), pjLeft); PrintFooter ('Date 01/20/95', PJRight); SectionBottom: = 10.5; {RESET Section Bottom} Originx: = 0.0; Originy: = 0.5; SetFont ('Arial', 10);
{Semicircular arc} setpen (CLBLACK, PSSOLID, -2, PMCopy); {set Pen to Black 2 / 100ths "Wide} ypos: = 0.95; PrintCenter ('arc () and chord ()', 2.125); ARC ( 1.125, 1.0, 3.125, 3.0, 3.125, 2.0, 0.0, 0.0); Setbrush (CLBLACK, BSCLEAR, NIL); ChORD (1.125, 1.0, 3.125, 3.0, 0.0, 0.8, 3.125, 2.25); {Pie} YPOS : = 0.95; PrintCenter ('Pie ()', 4.25); setpen (CLBLACK, PSSOLID, -2, PMCopy; {set pen to black 2 / 100ths "wide} setbrush (CLBLACK, BSHORIZONTAL, NIL); PIE (3.25 1.0, 5.25, 3.0, 5.25, 2.0, 0.0, 0.0); Setbrush (CLBLACK, BSVertical, NIL); PIE (3.25, 1.0, 5.25, 3.0, 0.0, 0.0, 3.25, 7.0); setbrush (CLBLACK, BSBDIAGONAL, NIL); PIE (3.25, 1.0, 5.25, 3.0, 3.25, 7.0, 5.25, 2.0); {Bitmap Picture} YPOS: = 3.4; PRINTCENTER ('PaintBitmapRect ()', 6.375); Bitmap: = Tbitmap.create; Bitmap .LoadFromFile ( 'RPDEMO.BMP'); PrintBitmapRect (5.375,3.5,7.375,5.5, Bitmap); Bitmap.Free; end; end; procedure TForm1.Button1Click (Sender: TObject); begin RvSystem1.Execute; // run reports ! End; end. ################################################################################################################################################################################################################################################################################################### #################################################
Ok, so that we have not used RAVE, just use the program to implement the report.
(PS: Please indicate the author - the fish (CYQ) on the highway)