FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour From FastReport to HTML
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
From FastReport to HTML
Posted: Thu Jul 31, 2025 10:26 AM

Hello,

I’ve used FastReport in combination with FiveWin/FWH for years. The layout files (.FR3) were usually loaded with frReportManager() and displayed via :ShowReport(). It basically works, but:

The .fp3 format is proprietary

Access to pages (e.g., :Pages, :EMF) is limited or blocked

Customization (e.g., preview without PDF, HTML output, web printing) is difficult to control

My goal:

Clear, transparent HTML output

Full control over data and layout

Easy to print – even on mobile

Instead of using oFr:ShowReport(), I simply created a small JSON export:

GO TOP

FCreate("abreisedaten.json")

// ... iterate through all records

// ... group all fields by departure date

// ... save as JSON

At the same time, I sent the content of the .FR3 file – i.e., the XML from the FastReport designer – to the AI. The result:

A 100% matching HTML file with placeholders and grouping – ready for display and printing!

The big advantage: I don’t need to retest the logic for calculations, since only the presentation changes – not the data source or evaluation.

Best regards,

Otto

Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: From FastReport to HTML
Posted: Wed Aug 27, 2025 03:44 PM
Hello Otto;

With FastReports you can load the report and without having to "show" it, you can export to html. Like this:
:DoExport( <cExportObjectName> )
Where cExportObjectName can be: "PDFExport", "HTMLExport", "RTFExport", "CSVExport", "XLSExport", "DotMatrixExport", "BMPExport", "JPEGExport", "TXTExport", "TIFFExport", "GIFExport", "SimpleTextExport", "MailExport", "XMLExport", "ODSExport", "ODTExport", "BIFFExport"

You can also open the report preview (show it) and hide most buttons restricting the user ability to execute certain functions.
Here is some sample code that replaces what some preview buttons do:
*-------------------------------------------------------------------------------------
FUNCTION SetFrOptions( oFr, oDbf, oBrw )
   LOCAL aPrinters := GetPrinters()
   LOCAL nPos := ASCAN( aPrinters, { |e| "FORMS" $ UPPER( e ) } )

   DEFAULT oBrw := NIL  //avoid compiler warning.  Not sure what I want to do with oBrw.
      
   WITH OBJECT oFr

      :PreviewOptions:SetOutlineWidth( 65 )
      :PreviewOptions:SetMaximized( .F. )
      :PreviewOptions:SetModal( .T. )
      :PreviewOptions:SetBounds( 120, 120, 850, 600 )
      :PreviewOptions:SetAllowEdit( .F. )
      :ReportOptions:SetAuthor( "Reinaldo Crespo-Bazan" )
      :ReportOptions:SetCompressed( .F. )
      :SetEventHandler( "Report", "OnUserFunction", { |cFunc, aParms|  CallUserFunc( cFunc, aParms ) } )
      :SetObjProperty( "Report", "ShowProgress", .T. )      
      :SetIcon( "Icon_0" )

      IF nPos > 0 
         :PrintOptions:SetPrinter( aPrinters[ nPos ] )
      ENDIF

      :SetEventHandler( "MailExport", "OnSendMail", { |a| SendReportViaeMail( a, oFr ) } )
   
      //:PreviewOptions:SetRemoveReportOnClose( .T. )
      //:SetEventHandler( "Report", "OnClosePreview", { || oFr:ClearDataSets() } )

      IF oDbf != NIL

         /*:SetEventHandler( "Report", "OnClosePreview", ;
            { |x| oDbf:GoTop(), iif( oBrw != NIL, oBrw:Refresh(), ) } ) */

      ENDIF

   END

RETURN NIL
Here is an example of an export to excel:
METHOD ExportASXLS() CLASS TMpReports

   WITH OBJECT ::oFr
   
      :SetProperty( "BIFFExport", "DeleteEmptyRows", .T. )
      :SetProperty( "BIFFExport", "FileName", ::cxlsFileName )
      :SetProperty( "BIFFExport", "Author", "Structured Systems Corp" )
      :SetProperty( "BIFFExport", "Subject", ::cRepName )
      :SetProperty( "BIFFExport", "Company", "www.structuredsystems.com" )
      :SetProperty( "BIFFExport", "ShowDialog", .F. )
      :SetProperty( "BIFFExport", "FitPages", .F. )
      :SetProperty( "BIFFExport", "SingleSheet", .T. )
      :SetProperty( "BIFFExport", "ShowProgress", .T. )
      :SetProperty( "BIFFExport", "WysIwyG", .F. )
      :SetProperty( "BIFFExport", "GridLines", .F. )
      :SetProperty( "BIFFExport", "Pictures", .T.)
      :SetProperty( "BIFFExport", "OpenAfterExport", .F. )
      :SetProperty( "BIFFExport", "Password", ALLTRIM( ::cPassword ) )
      :SetProperty( "BIFFExport", "Application", "Auto-Tasks Ver 0.10 Generated Report" )

      TRY
         :DoExport( "BIFFExport" )
      CATCH 
      END

   END WITH 

RETURN NIL
Maybe this helps.
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: From FastReport to HTML
Posted: Wed Aug 27, 2025 06:43 PM

Hello Rrinaldo,

Just to add one important note for Harbour developers:

Some years ago there was indeed a Harbour interface to FastReport, created by Sergey Spirin. Sadly he passed away, and the project was never continued.

That means today there is no maintained FastReport library for Harbour.

So if we want to keep using FastReport, the only realistic approach is to use it through a Xailer, Delphi/Lazarus host application or service (Harbour sends JSON/CSV/DBF β†’ host renders β†’ returns PDF/HTML).

For new projects, HTML-based reporting often gives us more transparency and long-term control.

Best regards,

Otto

Continue the discussion