How can I generate a PDF (or any other available type) without opening the preview window ?
  • Simplified Mode New!

The trick is t use the new "Object Type" 's available. Just change the Object Type value to get different outputs automatically, super fast !
New Object Type's available, after you Initialize FoxyPreviewer with a "DO FOXYPREVIEWER.APP" :
  • 10 = Regular PDF
  • 11 = PDF AS IMAGE, to be used when the report is somehow complicated, with many objects over the others. The rendered PDF document pages are images, that don't allow making searches, with a baz zoom effect
  • 12 = RTF
  • 13 = XLS
  • 14 = HTML

DO LOCFILE("FoxyPreviewer.App")
*' Make PDF
	(_Samples + "\Solution\Reports\Wrapping.frx") ;
	OBJECT TYPE 10 ; && OBJTYPE 10 = PDF , 11 = PDF AS IMAGE , 12 = RTF , 13 = XLS , 14 = HTML
	TO FILE "c:\TestReport.Pdf" ; && Destination
	PREVIEW && Open the default PDF viewer

  • Complete Mode
The trick is to use the property cDestFile. FoxyPreviewer will generate the output according to the file extension that you pass that property.

LOCAL loReport as "PreviewHelper" OF "FoxyPreviewer.App" 
loReport = CREATEOBJECT("PreviewHelper") 
WITH loReport as ReportHelper 
        .AddReport(_Samples + "\Solution\Reports\percent.frx", "NODIALOG") 
        .cDestFile = "c:\Teste1.pdf"  && Use to create an output without previewing
loReport = NULL 
RUN /N Explorer.Exe c:\Teste1.pdf 

The Print Preview Toolbar is visible but all buttons are disabled (not responding) in my Top-Level form report. How to fix that ?

Unfortunately, there is a known bug in VFP9 SP2, that makes all toolbars inside Top-Level forms not to respond. Fortunately, MS is distributing a hotfix for SP2, that fixes this issue. Please download the latest cumulative hotfix - KB968409 from

Please follow carefully all the instructions provided in the text file included in the download, and your toolbar will start working as advertised.

The easiest way to update your VFP9SP2 with the latest hotfixes is to install Woody's runtime installer, that can be found here: Woody's VFP9 SP2 Runtime Installer with all hotfixes (Rev 7423)
Mirror at Foxpert.comnew.gif

updated.gif When I run my reports with FoxyPreviewer sometimes asterisks symbols ********************* appear instead of the field. This was originally working, before using FoxyPreviewer

That happens because FoxyPreviewer uses the SET REPORTBEHAVIOR 90 mode, that uses GDI+ to render the texts. Unfortunately there is a slight difference of the size of the strings between these modes. To fix it, just edit your report and enlarge that field !

New! You can set the new property - lExpandFields to make the report engine show the field numeric value ignoring the field size.
Using "lExpandFields", FoxyPreviewer retrieves the value that overflowed and resends it to the report engine with an enlarged field width.

This is a known issue, and Lisa Slater Nicholls wrote a short blog post regarding it:
Why do report layouts in VFP9 need wider field/expression controls than in VFP8 and earlier?

And here's another interesting text from Lisa, that explains the reason for that:
With REPORTBEHAVIOR=90, the new report engine uses GDI+ to render output, and text string rendering requires more space than plain old GDI.
The Report Desiginer uses GDI - not GDI+ - to render the report layout components, including all the text strings that you see. So if you visually right-align a label report element, the report designer records the leftmost co-ordinates of the element (the text start position) in the layout.
The length of the string under GDI+ rendering will most likely be greater than what you would think, based on what you see in the Designer.

The Search button is not appearing
I can't see the save as PDF / RTF / XLS options when clicking the save button

Even if you setup correctly, marking these features to be shown, it may happen that FoxyPreviewer could not manage to load all of its libraries.
Make sure NOT TO USE the property cDefaultListener. Probably this will make everything to work as desired.
The cDefaultLIstener is for ADVANCED users only, people who really know how to use reportlisteners. And if you really need it, make sure to be using a subclass of FoxyListener, that is in PR_ReportListener.vcx in the Sources folder.

My VERY BIG report can't run with FoxyPreviewer

Unfortunately the VFP9 reporting system has a limit of pages / characters to be rendered. In most cases, reports with more than 3000 pages do not work, raising the error "Insufficient GDI+ resources". This is not a FoxyPreviewer issue. This limitation comes from VFP. Please reduce the scope of your report, or use SET REPORTBEHAVIOR 80 to run that report.

Reports characters are appearing very small when printed in a dot-matrix printer

This is a limitation of the VFP9 reporting system. If you are using FoxyPreviewer in the complete mode, you can setup the property lUseListener = .F. for that specific report. This will make FoxyPreviewer run the report in the ReportBehavior 80 mode.
If you are using FoxyPreviewer in the simplified mode, unfortunately there is nothing to do, except:
- Using FoxyPreviewer in the complete mode for this specific report

* ' Sample showing how to use the Complete mode for Dot-matrix printers
LOCAL loReport AS "PreviewHelper" OF "FoxyPreviewer.App" 
loReport = CREATEOBJECT("PreviewHelper") 
loReport.AddReport(_Samples + "\Solution\Reports\colors.frx") && FRX File, Clauses 
loReport.lUseListener = .F.

- Run this report using SET REPORTBEHAVIOR 80

How can I disable FoxyPreviewer?

Sometimes for some specific reason you need to turn off FoxyPreviewer, and reset your report settings to their original status.
Just run this single line of code:

new.gif Another simple option:

I can't send emails

Please check carefully the "Settings options" form.
In some computers the "MAPI" option does not work, and you should use the "CDOSYS" instead. Check with your SMTP server provider for the correct settings.

Updated! During FoxyPreviewer initialization, I get the error "Could not load the FOXYPREVIEWER report factory"

This happens because you are probably using an ancient version of ReportOutput.App

At the FoxyPreviewer downloads page you'll find the correct versions for you to download directly. Look for the file called Report.APP VFP9 SP2* at the "Other available downloads" section:
Cannot resolve image macro, invalid image name or id.

Another option, you can also get an updated version directly from VFPX, or even get the sources of it directly from MS and recompile it:

To recompile ReportOutput.App:
1 - Get the sources of them, the best place is MS Website directly
2 - Get the ZIP, unpack it
3 - Go to the ReportOutput folder. Open the ReportOutput project
4 - Recompile that project, following Leonid's suggestions,
5 - Use the new App instead of the original.
Please make sure to be using the latest version, by renaming all the old versions you have in your computer.

Can I use FoxyPreviewer without SP2 installed in my VFP9 ?

Yes !!!
For that, you'll just need to use the latest versions of ReportOutput.App and ReportPreview.App. Please read the previous item to get instructions on how you may get those files.

New! Do I need to Release FoxyPreviewer after every report ?
No !!!
You need to initialize FoxyPreviewer ONLY ONE TIME, at your startup PRG. After that, all reports from your application will have the benefits of FoxyPreviewer without any code change. If for any reason you need to return to the original behavior, just call SET REPORTBEHAVIOR 80, to tell VFP to return to the old Reporting style. To get back to FoxyPreviewer style, just call SET REPORTBEHAVIOR 90. In fact, when you switch between different REPORTBEHAVIOR settings, FoxyPreviewer keeps loaded in memory, but is not used if you select "80". FoxyPreviewer occupies few resources, so there's no reason to release it all the time.
If you need a full release, then
This will restore the SET PROCEDURE, SET CLASSLIB, Extension handler, and PreviewContainer

New! How can I provide user specific settings using FoxyPreviewer ?
There are several ways for you to do that.
At first run, FoxyPreviewer creates a Settings table that cotains information about the settings chosen by the user, when setting the Preferences window. This file is originally stored at the same folder of the file FoxyPreviewer.App. So, make save your FoxyPreviewer.app file in a folder that has Read/Write permissions.
You can also tell FoxyPreviewer the location where you want it to store the Settings file, or the folder where the settings file that you want is stored, by passing the directory as a parameter during the initialization:

Apart from that, you can also determine which options will be available to each user in the Settings form. Apart from determining if he'll have the settings button available, you can also determine which PgFrame pages will be available, and even what controls will be enabled. Use the _Screen.oFoxyPreviewer.oSettingsDlg object. Use the Intellisense in development mode to see all the available properties or refer to the docs of FoxyPreviewer.

DO FoxyPreviewer.App

_Screen.oFoxyPreviewer.cLanguage  = "PORTUGUES"

*' After initializing FoxyPreviewer, here are some optional properties that you can set:
*' choosing what controls or tabs will be disabled in the settings form
*' This brings you an option to control what functions each user will have available
WITH _Screen.oFoxyPreviewer.oSettingsDlg
	.lEnableTabPdf        = .F.
	.lEnableLanguage      = .F.
	.lEnableChkSaveasTxt  = .F.
	.lEnableChkSaveasHtml = .F.

New! When I click on the "Save" button at the preview toolbar, the file options menu does not appear - (Thanks to Jose Antonio Blasco for the find)
First of all, make sure to be using the latest version of FoxyPreviewer. There was a related issue that happened with people who have the "SET KEYCOMP TO DOS" setting enabled. This was fixed since v2.60.
Apart from that, some incompatibilities with some visual or non visual OLE controls (active-X) may happen. FoxyPreviewer can get confused if these objects maintain the focus during the Report run. Please make sure to remove the focus from any Active-X object, such as the WebBrowser control, the MS TreeView control, etc, and run the REPORT PREVIEW.

New! When I send a report directly to the printer using "REPORT FORM ... TO PRINTER", without previewing, it does not print with full justification when I add the "<FJ>" tag in the User field of the report

The FOXYLISTENER, that is who is responsible for the FullJustify, and other effects is not initialized by default. FoxyPreviewer was created originally to manipulate previews, but there's something that you can still do for direct printing using that Listener:

DO LOCFILE("FoxyPreviewer.App") &&' Init FoxyPreviewer
*' Create an instance of the FoxyListener from the class stored in the APP
LOCAL loListener as ReportListener 
loListener.ListenerType = 0 &&' Set the listener to "Printing" mode
REPORT FORM YourReportWithFJ TO PRINTER OBJECT loListener &&' Call the report normally

New! The embedded images in my Project / EXE are not being exported to PDF

That happens because "FoxyPreviewer.APP" is an external library, and cannot access the files embedded in your EXE. In this case, you have 2 options:

OPTION #1 - Store the image files outside your EXE, in a drive location, that can be passed with the full address, so that FoxyPreviewer.App can "see" these files and include them in your desired output.

OPTION #2 - To make these images appear automatically, without the need of removing the image files from your project.
- First of all, make sure to be using the latest version of FoxyPreviewer.
- Include the program "FOXYGETIMAGE.PRG" in your EXE project. This file is found at the "Sources" folder of FoxyPreviewer. This file will provide access to FoxyPreviewer to get the needed images from the executable. Please note that this may bring some security issues to your EXE, because this program will allow FoxyPreviewer and other programs to access the embedded images of your EXE. I recommend you to open this file, and analyze it. You can make any changes you find necessary to it, for example to make it allow only some specific files to be accessed. Right now, FOXYGETIMAGE.PRG allows accessing only image files, with the extensions: "BMP", "GIF", "PNG", "JPG", "JPEG", "TIFF", "TIF", "EMF".

Why do some texts refuse to appear in the report using FoxyPreviewer?

FoxyPreviewer relies on SET REPORTBEHAVIOR 90, that uses GDI to generate the outputs. Unfortunately, not all fonts are compatible with GDI. By definition, a font needs to be "TrueType", but there still remain some cases when some fonts will not work.

The best to do when testing your reports is to try replacing the font with another well known, such as Tahoma, Arial or Courier New.

You can also check if a font is compatible with GDI+ by using the script below:

LOCAL lcFontName, llAllowed
lcFontName = GETWORDNUM(GETFONT(),1,",")
llAllowed  = IsGdipFont(lcFontName)
MESSAGEBOX("The font " + lcFontName + " is " + IIF(llAllowed, "", "NOT ") + "compatible with GDI+ !")

... and here's the function.



*' The Gdi+ API declarations were "Aliased" to avoid problems with other possible Gdi+ classes 
*' working at the same time

*' GDI+ Initialization and Shutdown
	as FBC_GdiplusStartup ;

	as FBC_GdiplusShutdown ;
    LONG token

*' FontFamily functions
	as FBC_GdipCreateFontFamilyFromName ;
	STRING familyname, INTEGER FontCollection, INTEGER @FontFamily

	as FBC_GdipDeleteFontFamily ;
	INTEGER FontFamily

LOCAL lcStartupInput, lcGdipToken
lcStartupInput = CHR(1) + REPLICATE(CHR(0), 15)	&&' GdiplusStartupInput structure (sizeof = 16)
*' Initialize GDI+
lcGdipToken = 0
IF FBC_GdiplusStartup(@lcGdipToken, @lcStartupInput, 0) != 0
   RETURN .F. &&' Could not initialize Gdi+

LOCAL lnStatus, lhFontFamily, llCanUse
lhFontFamily = 0

lnStatus = FBC_GdipCreateFontFamilyFromName(STRCONV(tcFont,5), 0, @lhFontFamily)

llCanUse = lhFontFamily <> 0
IF llCanUse
	*' Clear the Gdi+ FontFamily created
	lnStatus = FBC_GdipDeleteFontFamily(lhFontFamily)

*' Clear the Gdi+ handle
lnStatus = FBC_GdiplusShutdown(lcGdipToken)


Last edited May 28, 2016 at 11:12 PM by VfpImaging, version 13