ZT: How to display the print preview dialog of the Chinese culture

zhaozj2021-02-16  57

How to display the print preview dialog of the Chinese culture

Copy the rpFormPreView.PAS and RPFormPreView.dfm in the C: / Rave5 / Source directory to the corresponding project directory.

Add RPFormPreview.PAS to the corresponding project file, change the name of the corresponding form from RavePreviewForm to ScravePreviewForm; save the file RpFormPreView.PAS as scFormPreview.PAS.

Change the correspondence in the form ScravePreviewForm to Chinese.

On the main form, add the RVProject and Rvsystem components, simply hook it by setting RvProject.Engine as the RVSystem component.

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: = ReportSystem.SystemPreview.FormState; (OverrideForm As TSCRavePreviewForm) .ReportSystem: = ReportSystem; End; omShow: Begin ReportSystem.SystemPreview. 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 T SCRavePreviewForm) .InputStream: = ReportSystem.SystemFiler.Stream; (OverrideForm As TSCRavePreviewForm) .InitFromRPSystem; (* *) If soPreviewModal In ReportSystem.SystemOptions Then Begin OverrideForm.ShowModal; End Else Begin OverrideForm.Show; End; {else} End; OMWAIT: Begin if not (SopreviewModal in Reportsystem.systemOptions) The begin // Wait for Close Repeat Sleep (250); Application.ProcessMessages; Until NOT OVERRIDEFORM.Visible; end; {i} 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 (Over); end; end; {copy; END; Compilation of this project, its print preview window will become Chinese! Remarks: This way is in the way China will not be affected by the RAVE version upgrade!

-------------------------------------------------- ----------------------------------------

Reference

This is the recommended method for those that have Rave Reports source code (BEX customers). This method shows how to override the built-in preview system. This approach is more flexible and therefore, more desirable. In simple terms, you copy the existing preview source (RpFormPreview) to a different name (say MyPreview). Then you use the RpSystem source to see how the OverridePreviewProc is structured and copy appropriate parts to your RvSystem component overridepreview event. Now here are the steps.PART 11. Copy RpFormPreview. PAS and RpFormPreview.DFM to new files, let's call them MyPreview.PAS and MyPreview.DFM.2. Open MyPreview.PAS inside Delphi (preferably with your project already open) and rename the unit heading to MyPreview.3. Rename the form associated with MyPreview.PAS to MyPreviewForm in the Object Inspector.4. Add the unit MyPreview to your project using the project manager.PART 25. Open the file RPSYSTEM.PAS from the source subdirectory and go to the procedure OverrideP reviewProc. This block of code will be used in the next step.6. Go to one of your ReportSystem components and open event tab. Then create (double-click) on the OverridePreview event. In OverridePreview code area copy the corresponding code from the RPSYSTEM.PAS OverridePreviewProc block of code.7. Replace all occurrences of TRPPreviewForm (standard preview) with TMyPreviewForm (your custom preview) throughout the new OverridePreview procedure.8. Make some simple change to your MyPreview source. For example, change the caption to Read "New Custom Preview" .9. Recompile Your Project Using Build All.Run Your Program and Generate A Report That Uses The Modified Reportsystem Component. if You See Your "New Custom Preview"

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

New Post(0)