Use RAVE reports in Delphi 7 (7)

xiaoxiao2021-03-06  18

Use RAVE reports in Delphi 7 (7)

---- Some skills

As a final, some techniques are given to everyone as the end of "using the RAVE report" in Delphi 7.

1. How do design a good RAVE report file to package to an EXE file?

There is a StoreraV in the attribute of RVProject, as long as the RAV file corresponding to the LOAD!

It is best to empty the ProjectFile property corresponding to RvProject.

2. How to display the print preview dialog of Chinese culture?

Copy C: / Rave5 / Source directory rpFormPreview.PAS and rpFormPreview.dfm to the corresponding item

In the directory.

Add rpformpreview.pas to the corresponding project file, put the name of the corresponding form from

RavePreviewForm Change to ScravePreviewForm; save the file RpFormPreView.PAS as

SCFormPreview.PAS.

Change the correspondence in the form ScravePreviewForm to Chinese.

Adding rvproject and rvsystem components on the main form, by setting RvProject.Engine

Rvsystem components are hung by both.

Setting the OverridepReView event procedure of the RVSystem part for the following code:

Procedure TFORM1.RVSYSTEM1OVERRIDEPREVIEW (Reportsystem: Trvsystem;

Overridemode: Toverridemode; VAR OVERRIDEFORM: TFORM;

Begin

Case Overridemode of

omcreate:

Begin

Overrideform: = TscravePreviewForm.create (Self);

//Overrideform.caption: = reportsystem.titlepreview;

Overrideform.width: = reportsystem.systempreview.formwidth;

Overrideform.height: = reportsystem.systempreview.formheight;

Overrideform.windowState: = reportysystem.systempreview.formstate;

(OverrideForm as TscravePreviewForm) .reportsystem: = Reportsystem;

END;

OMSHOW:

Begin

ReportSystem.System.Initpreview ((Overrideform As)

TscravePreviewForm) .rvrenderpreview);

IF Assigned (Reportsystem.onPreviewsetup) THEN

Begin

ReportSystem.onPreviewSetup ((Overrideform As)

TscravePreviewForm) .rvrenderpreview);

End; {if}

(OverrideForm As TscravePreviewForm) .InputFileName: =

Reportsystem.systemfiler.filename;

(OVERRIDEFORM AS TSCRAVEPREVIEWFORM) .INPUTSTREAM: =

Reportsystem.systemfiler.stream;

Overrideform as tscravePreviewForm .initfromrpsystem;

(* *)

IF SopreviewModal in Reportsystem.systemOptions Thenbegin

Overrideform.ShowModal;

End

Else

Begin

Overrideform.show;

End; {else}

END;

Omwait:

Begin

IF (SopreviewModal in Reportsystem.systemOptions) THEN

Begin

// Wait for Close

Repeat

Sleep (250);

Application.ProcessMESSAGES;

Until NOT OVERRIDEFORM.VISIBLE;

End; {if}

END;

OMFree:

Begin

IF (ReportSystem.Systemfiler.Streammode In [Smtempfile, SMFile]) THEN

Begin

Overrideform as tscravepreviewForm ).rvrenderpreview.ndrstream.free;

(OVERRIDEFORM AS TSCRAVEPREVIEWFORM ).rvrenderpreview.ndrstream: =

NIL;

End; {if}

Freeandnil (OVERRIDEFORM);

END;

End; {cas}

END;

Compiling this project, the print preview window will become Chinese.

Remarks: This approach is not affected by the RAVE version upgrade.

3. How to display the print settings dialog box in China?

Copy C: / Rave5 / Source directory rpformsetup.pas and rpformsetup.dfm to the corresponding project

Recording.

Add rpformsetup.pas to the corresponding project file, change the name of the corresponding form from RPSetupForm

Save the file rpformsetup.pas as scFormsetup.pas for scsetupform;

Change the correspondence in the form ScsetupForm to Chinese.

Adding rvproject and rvsystem components on the main form, by setting RvProject.Engine

Rvsystem components are hung by both.

Setting the OverridSetup event procedure of the RVSystem component for the following code:

Procedure TFORM1.RVSYSTEM1OVERRIDESETUP (Reportsystem: Trvsystem;

Overridemode: Toverridemode; VAR OVERRIDEFORM: TFORM;

Begin

Case

Overridemode of

omcreate:

Begin

Overrideform: = TscSetupForm.create (nil);

//Overrideform.caption: = rvsystem1.titlesetup;

(OverrideForm as tscsetupform) .reportsystem: = ReportSystem;

END;

OMSHOW:

Begin

With overrideform as tscsetupform, Reportsystem Do

Begin

PreviewSetup: = FALSE;

Aborted: = showmodal = mrcancel;

END;

END;

Omwait:

Begin

{Because Showmodal: no wait nextary!

END;

OMFree:

Begin

Overrideform.free;

END;

END;

END;

Compiling this project, its print settings dialog box will become Chinese! In this way, Chinese culture will not be affected by the RAVE version upgrade!

For other dialogs, you should work with the same mana!

4. How to do a preview window?

Create a window, put the rvproject component, RVNDRWRITER components, RVRenderPreView components, and scrollbox components, set the contact relationship between the following parts:

RvProject.Engine: = RVNDRWRITER;

RvRenderPreview.ScrollBox: = scrollbox;

Set RVNDRWRITER.FILENAME to Demo.ndr;

The code for previewing is:

VAR

NDRSTREAM: TMEMORYSTREAM;

Begin

// Establish memory flow

NDRSTREAM: = TMemoryStream.create

/ / Output report data

RvProject1.execute

// Turn the report data to memory flow for preview

NDRSTREAM.LOADFROMFILE ('Demo.ndr');

/ / Preview the corresponding report, use the corresponding memory stream.

RvRenderPreview1.render (ndrstream);

Showbutton ();

END;

To apply Rave Handbook, more content reference / RAVE5 / DOCS / RAVE manual in your project.

转载请注明原文地址:https://www.9cbs.com/read-44729.html

New Post(0)