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
From FastReport to HTML
- reinaldocrespo
- Posts: 991
- Joined: Thu Nov 17, 2005 5:49 pm
- Location: Fort Lauderdale, FL
Re: From FastReport to HTML
Hello Otto;
With FastReports you can load the report and without having to "show" it, you can export to html. Like this:
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:
Here is an example of an export to excel:
Maybe this helps.
With FastReports you can load the report and without having to "show" it, you can export to html. Like this:
Code: Select all | Expand
:DoExport( <cExportObjectName> )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:
Code: Select all | Expand
*-------------------------------------------------------------------------------------
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
Code: Select all | Expand
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
Re: From FastReport to HTML
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 -, 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
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 -, 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