This is the most common use case. It creates a standard PDF file.
LOCAL loXFRX, lnRetVal
* 1. Initialize
loXFRX = XFRX("XFRX#Init")
* 2. Set Output
* Arguments: Output Type, Filename
lnRetVal = loXFRX.SetTarget("PDF", "c:\temp\myreport.pdf")
IF lnRetVal = 0
* 3. Run the report
* Arguments: Report File, Report Target
loXFRX.processReport("myreport.frx", "")
* 4. Finalize the document (Critical for PDFs)
loXFRX.finalize()
MESSAGEBOX("PDF Created Successfully!")
ELSE
MESSAGEBOX("Error initializing XFRX.")
ENDIF
Doc Section: Installation & Registration
Cause: xfrx.prg and xfrx.fll not in VFP’s search path, or license file missing.
Solution: The documentation provides a diagnostic script: xfrx documentation
SET PATH TO “C:\XFRX” ADDITIVE
DO xfrx
? xfrxVersion() && Should return “16.0.x”
Let’s walk through a concrete example that follows the official XFRX documentation steps: This is the most common use case
You aren’t limited to the built-in listeners. The docs explain how to subclass xfrxlistener and override OnRecord, OnBand, or OnPageEnd to generate custom JSON, CSV, or even SQL INSERT statements from any report. Doc Section: Installation & Registration
Cause: xfrx
Even experienced users fall into these traps. The documentation provides the escape routes.
| Problem | Documentation Solution |
| :--- | :--- |
| Reference count memory leak | Section "Releasing XFRX Listeners": Always call .Release() and set loListener = NULL. |
| Excel export with wrong column widths | Chapter "Excel Output Tweaks": Use SetColumnWidthInExcel(table, startcol, width) or design the FRX with exact coordinates. |
| Missing fonts in PDF | SetFontEmbedding() and list of default XFRX-supported fonts (Arial, Courier, Times). |
| Report runs slowly for 10,000+ pages | Advanced section "Batch Mode": Use SetDrawPages(.F.) and SetCachedMode(.T.). |
| Unicode characters become '?' | Page 147: Call SetUnicode(.T.) and ensure your VFP session uses UTF-16LE compatible locale. |