eDocEngine VCL
Create documents and reports in 18 formats
Compatibility
Delphi C++Builder

Export From Rave Reports To PDF And Other Formats

Interactive and programmatic export from Rave Reports using Gnostice eDocEngine VCL.
By V. Subhash

eDocEngine has "report-export interface components" for providing multiple output format support for Delphi reporting tools. For Rave Reports, eDocEngine has the TgtRaveExportInterface interface component.

You can either let the end-user of the Rave Reports application to choose the output provided by eDocEngine in an interactive report "Save" dialog box or you could export the report programmatically in Object Pascal.

On an application built with Rave Reports, an instance of this interface component needs to be paired up with an eDocEngine document-creation engine component. For example, to output a Rave Reports report to PDF, a TgtRaveExportInterface instance needs to be paired with a TgtPDFEngine instance on the same form as a Rave Reports control.

Interactive Rave Reports Export

If you have an existing Rave Reports application and wish to let the end-user select the output format, then you can add eDocEngine output support without writing any code. Just follow these steps.

  1. Open the Rave Reports project in the IDE.
  2. From the eDocEngine Additionals tab on the Tools Palette, add TgtRaveExportInterface control to the form that contains a Rave Reports control.
  3. From the eDocEngine tab of the Tool Palette, add a document-creation engine component, such as TgtPDFEngine, to the form.
  4. If you need to differentiate the eDocEngine output format from the built-in ReportBuilder output formats, then set FileDescription property of the document-creation engine. For PDF output, use a value such as 'PDF generated by eDocEngine'.
  5. Set the Engine property of the TgtRaveExportInterface control to the engine control. If you had chosen the TgtPDFEngine control, the reporting application would have automatically gained PDF output support.

If you need to create a reporting application from scratch using eDocEngine and Rave Reports, try the following steps:

  1. Start the IDE and create a VCL forms application project.
  2. In the Code view, add RvDLADO to the Uses clause.
  3. Drop TRvProject, TgtPDFEngine, TgtRaveExportInterface, and TButton controls on the form.
  4. Set the Engine property of the TgtRaveExportInterface to the TgtPDFEngine control.
  5. Double-click TRvProject, create a Rave Reports report and save it with a name.
    1. From the Rave Visual Designer toolbar, click on New Data Object icon to display Data Connections dialog.
    2. Select Database Connection data object type and click Next.
    3. Select ADO database connection type and click Finish.
    4. In the Database Connection Parameters dialog, create a Connection String to a database. This database will be listed under the Project Tree panel.
    5. From the designer toolbar, click on New Data Object icon again to display Data Connections dialog.
    6. Select Driver Data View data connection and click on Next to display the Data Connections dialog.
    7. Select database item you had created earlier and click Finish to Query Advanced Designer.
    8. Click the Editor button, enter an SQL query to retrieve records from a table or view in the database and click OK. (For the NorthWind database that comes with Microsoft Access or SQL Server, you could try: SELECT FIRSTNAME, LASTNAME, ADDRESS, CITY, COUNTRY FROM EMPLOYEES.) After clicking OK, a Driver Data View item will be added to the Project Tree panel.
    9. From the main menu, select Reports » Report Wizards » Simple Table to display a wizard.
    10. Select the driver data view you had created earlier and click Next.
    11. On the next page, select all fields from the table and click Next.
    12. On the next page, rearrange the fields if necessary and click Next.
    13. In the next page, change the report layout options if required.
    14. In the next page, change the font styles used in the report and click the Generate button.
    15. Save the report, close it and return to the form on the IDE.
  6. Double-click the button and add the following code.
    gtPDFEngine1.FileDescription := 'PDF generated by eDocEngine';
    RvProject1.SetProjectFile('eDocEngine_Rave_Demo.rav');
    RvProject1.Open;
    RvProject1.Execute;
    RvProject1.Close;
    
  7. Run the project and click the button. The Output Options dialog will be displayed.
  8. In the Report Destination section, click on File to output the report to file.
  9. In the Format box, select the PDF option.
  10. Enter the path name of the output document and click OK.

Programmatic Export From Rave Report Snapshot File

In this example, eDocEngine will be used to export a Rave Reports report from an NDR (Rave Report snapshot) file.

  1. Open the IDE and create a VCL forms application.
  2. Drop three Rave Reports export interface components (TgtRaveExportInterface) on the form.
  3. Drop a PDF engine (TgtPDFEngine), RTF engine (TgtRTFEngine) and XHTML engine (TgtXHTMLEngine) components on the form.
  4. Add a button to the form and set this procedure for its click event handler
    procedure TForm5.Button2Click(Sender: TObject);
    begin
      // Set output engines for the report export components
      gtRaveExportInterface1.Engine := gtPDFEngine1;
      gtRaveExportInterface2.Engine := gtRTFEngine1;
      gtRaveExportInterface3.Engine := gtXHTMLEngine1;
    
      // Disable output preferences dialog boxes
      gtPDFEngine1.Preferences.ShowSetupDialog := false;
      gtRTFEngine1.Preferences.ShowSetupDialog := false;
      gtXHTMLEngine1.Preferences.ShowSetupDialog := false;
    
      // Set output file name of the engines
      gtPDFEngine1.FileName := 'eDoc_Rave_Demo.pdf';
      gtRTFEngine1.FileName := 'eDoc_Rave_Demo.rtf';
      gtXHTMLEngine1.FileName := 'eDoc_Rave_Demo.html';
    
      // Export a Rave Reports snapshot file to PDF, RTF and XHTML
      gtRaveExportInterface1.RenderDocument('eDoc_Rave.ndr');
      gtRaveExportInterface2.RenderDocument('eDoc_Rave.ndr');
      gtRaveExportInterface3.RenderDocument('eDoc_Rave.ndr');
    end;
    

The TgtRaveExportInterface has another RenderDocument() overload that exports the report from a stream containing the snapshot file.

public procedure RenderDocument(
    ANDRStream: TStream
); overload;

---o0O0o---

Our .NET Developer Tools
Gnostice Document Studio .NET

Multi-format document-processing component suite for .NET developers.

PDFOne .NET

A .NET PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, and bookmark PDF documents in .NET applications.

Our Delphi/C++Builder developer tools
Gnostice Document Studio Delphi

Multi-format document-processing component suite for Delphi/C++Builder developers, covering both VCL and FireMonkey platforms.

eDocEngine VCL

A Delphi/C++Builder component suite for creating documents in over 20 formats and also export reports from popular Delphi reporting tools.

PDFtoolkit VCL

A Delphi/C++Builder component suite to edit, enhance, view, print, merge, split, encrypt, annotate, and bookmark PDF documents.

Our Java developer tools
Gnostice Document Studio Java

Multi-format document-processing component suite for Java developers.

PDFOne (for Java)

A Java PDF component suite to create, edit, view, print, reorganize, encrypt, annotate, bookmark PDF documents in Java applications.

Our Platform-Agnostic Cloud and On-Premises APIs
StarDocs

Cloud-hosted and On-Premises REST-based document-processing and document-viewing APIs

Privacy | Legal | Feedback | Newsletter | Blog | Resellers © 2002-2024 Gnostice Information Technologies Private Limited. All rights reserved.