Menu

Documentation



documentation, 3203K, Releases May 15, 2013





PREREQUISITES:

Visual FoxPro 9 SP2

If you use Top-Level forms, the installation of the latest cumulative HotFix for VFP9SP2 KB 968409 is required, to fix a bug from SP2 that makes the toolbar in a Top-Level form look disabled.

You can choose one of the following options to get the latest VFP9 Hotfix for SP2:
1 - Download from Microsoft directly. Make a search for KB968409. Their link has changes my times in the past years
2 - Get from the downloads page in this site
4 - Get MyVfpUp2Date

USAGE:

  • WITHOUT CHANGING ANY CODE IN YOUR APP (Simplified and recommended mode)
See how simple it is to change completely the look and give some super powers to your reports:

DO FOXYPREVIEWER.APP 
REPORT FORM YourReport PREVIEW 

That's all !
That means that all you need to do is to "DO FoxyPreviewer.App" at the beginning of your executable, and ALL your reports that use the "PREVIEW" clause will be shown using the simplified but super powerful interface of FoxyPreviewer!

IMPORTANT:
Make sure to store the file FoxyPreviewer.App in a folder that has READ/WRITE permissions, because it will create and store some helper files that it needs to use at the same folder.


CUSTOMIZING SETTING PROPERTIES


Immediately after you "DO FOXYPREVIEWER.APP" all the properties below will be available in the "_Screen.oFoxyPreviewer" object.

You may choose what features will be available in the report preview toolbar, customize your documents, and even how the dialogs will appear. There are some few and obvious properties that you may set in order to fit your needs. Below are the methods and properties available:

Properties

You don't need to configure them at all. You can let your users determine all their preferences using the preferences button. 

General
  •  cTitle - character, the preview window title.
  •  nShowToolBar - numeric, determines the visibility of the report toolbar when the preview is run. (1 = Visible (default), 2 = Invisible, 3 = Use resource) Relevant when '.nPreviewMode=1'.
  •  nWindowState - numeric, determines the PreviewForm.WindowState 0 = Normal, 2 = Maximized
  •  nDockType - logical or numeric (0-4). If False, the dock will follow the resource file used. Or numeric, to force the toolbar docking. Applicable only when '.nPreviewMode=1 && Toolbar default'
    • –1 Undocks the toolbar or form.
    • 0 Positions the toolbar or form at the top of the main Visual FoxPro window.
    • 1 Positions the toolbar or form at the left side of the main Visual FoxPro window.
    • 2 Positions the toolbar or form at the right side of the main Visual FoxPro window.
    • 3 Positions the toolbar or form at the bottom of the main Visual FoxPro window.
    • 4 Keep the current dock settings from the resource file
  •  nMaxMiniatureDisplay - numeric, the quantity of reports to be shown in the miniatures form. Applicable only when '.nPreviewMode=1 && Toolbar default'
  •  cFormIcon - character, the file name of the icon to be used in the preview and other helper forms. This file should not be embedded in your main EXE.
  •  nThermType - numeric, the thermometer (progress bar) type used (1 = VFP9 Default, 2 = Enhanced windows compatible, recommended)
  •  lQuietMode - logical, determines the QuietMode property for the listeners used. The progressbar for the report generation and email sending is determined by this property. && Default = .F.
  •  cDestFile - character, determines the filename of the output file to be generated when the REPORT FORM command is executed. This property is also populated with the last file name that the user chose for saving the output of the current report session.
  •  nSearchPages - numeric, determines the quantity of pages that will be scanned during Searches in previews. Default = -1 (all pages)
  •  nButtonSize - numeric, determines the size of the buttons in the preview toolbar (1 = 16x16 pixels (default), 2 = 32x32 pixels)
  •  cLanguage - character, The default language used in all dialogs and tooltips. (English, Spanish, Portuguese, French, Italian, Arabic, Hebrew, Persian, Dutch, German among others)
  •  cPrinterName - character, the name of the default printer to be used
  •  lOpenViewer - logical, determines if the saved report will be automatically opened after generated, using the default app defined in the user's machine.
  •  lExpandFields - logical, makes the report not to show the "*" if numeric values overflow. Since it makes the report running a little bit slower, by default it will continue with the original behavior. You have to set it manualy if you need it.
  •  cPrintJobName - character, the name of the current PrintJob used. That's the name that will appear in the printer spooler. By default, the current report file name will be used on each run.
  •  lRepeatInPage  - logical, determines if the current report will print twice in the same page, repeating the contents, starting from the half vertical part of the page. Works only when you run the report in the preview. In the preview window, the report will look as original. The 2nd copy will be printed in the same page only when you click the "Print" button in the toolbar or Context menu. 
  • IMPORTANT: The page repetition will be applied only if you select a quantity of copies > 1
  • You can leave the property "lRepeatInPage = .T." all the time on, allowing FoxyPreviewer to print your report twice in the same page if the user wants more than one copy and the report does not occupy more than half the page. This is a cool feature, allowing your users to save paper sheets!
  • If the report contains more than one page, even if the contents do not use more than half the page, this property will not be considered. If you select "nCopies = 3" and "lRepeatInPage = .T.", having the needed space in the sheet of paper, FoxyPreviewer will print the report twice in the 1st paper, and another single time in the next sheet.
  •  lRepeatWhenFree - logical, determines if the current report will print twice in the same page, when "nCopies" > 1 and the current report has only one page, and occupies less than half a page, repeating the contents, starting from the half vertical part of the page. Works only when you run the report in the preview. In the preview window, the report will look as original. The 2nd copy will be printed in the same page only when you click the "Print" button in the toolbar or Context menu. 
  •  lDoubleByteLanguage - logical, informs that the system is using a DoubleByte language, such as Chinese or Japanese. This is primarily to make the context menu for the Save button in the report preview toolbar work in these languages. 
  •  nPreviewBackColor - numeric, the RGB color value, allows changing the back color of the report preview form.
  •  cTempFolder - Character, determines the Temporary folder to be used by FoxyPreviewer. Default = SYS(2023) + "FP_TEMPOUT". We can predetermine the "TEMPFOLDER" location at initialization, using the <TEMPFOLDER> tag as well:
    DO FOXYPREVIEWER.APP WITH "<CLEAN/><PATH>d:\Users\Steve</Path><USER>Steve</USER><IMAGESPATH></IMAGESPATH><TEMPFOLDER></TEMPFOLDER>"
  •  nPreviewMode - Numeric (1-3), determines the Preview mode: 1=default preview with toolbars; 2=Enhanced preview, with a scrollable container and all the buttons fixed on the top (modern looking); 3=Ribbon (FPv3)
     nRenderMode - Numeric, determines the custom rendering mode. 1=Default, 2=EMF file mode, High DPI Friendly, 3=Custom GDI+ redraw, High DPI Friendly (FPv3)
     nResolutionQuality - Numeric, determines the quality of the Report image exported (1-10). Default = 1 - low quality. Applicable when you export the report to an image format only, like BMP, PNG or JPG
     nThermFormWidth - Numeric, specifies the width of the Thermometer form. Useful when a big caption is needed. Works only if ".nThermType = 2 && Windows default
     lSlowPreview - Logical, workaround to avoid using EMFs to render the report preview in the new "Scrollable container preview mode" (.nPreviewMode=2). The report image is converted to a BMP, avoiding the flickering issues, but the extra processing slows down a little the preview. Default = .F.
     cCodePage - Character, the default CodePage used by the Listeners to generate the desired outputs (PDF, XLS, RTF, HTML). Default = "CP1252"
     lSlowPreview - Logical, workaround to avoid using EMFs to render the report preview in the new "Scrollable container preview mode" (.nPreviewMode=2). The report image is converted to a BMP, avoiding the flickering issues, but the extra processing slows down a little the preview. Default = .F.


Preview Toolbar
  •  cToolbarTitle - character, determines the title of the report toolbar. Relevant when '.nPreviewMode=1'.
  •  lSendToEmail - logical, determines if the "send to email" button will be shown in the Preview Toolbar. You or the user need to configure the e-mail settings to make it work properly!
  •  lSaveToFile - logical, determines if the "Save to File" button will be shown in the preview Toolbar.
     lShowFileFormatIcons - logical, Shows / hides the file format icons in context menus for saving.
  •  lShowCopies - logical, shows the copies spinner in the Preview toolbar.
  •  lShowMiniatures - logical, shows or hides the miniatures button in the Preview Toolbar.
  •  lShowSetup - logical, shows or hides the user preferences button in the preview toolbar
  •  lShowPrinters - logical, determines if the available printers combo will be shown in the preview toolbar.
  •  lShowSearch - logical, determines if the Search buttons will be visible in the preview toolbar
  •  lShowClose - logical, determines if the Close button will be visible in the preview toolbar
  •  nCopies - numeric, the default quantity of copies to be printed. This will be kept on the next report runs. So, make sure to restore its value after the report run.
  •  lPrintVisible - logical, shows or hides the "Printing" and "Exporting" related buttons in the toolbar and context menu; if .F., excludes ALL print-related controls from the toolbar, regardless of their individual include/exclude property settings.
  •  lShowPrintBtn  - logical, allows to individually show or hide the "Direct Print" button. This is different from the property "lPrintVisible", that hides/shows ALL the printing related buttons. This property deals only with the "Print" button.
  •  lShowShareBtn  - logical, shows / hides the "Share" button in the Preview Toolbar.
  •  nZoomLevel - numeric, the initial zoom level of the preview window. Possible values are: 1-10%, 2-25%, 3-50%, 4-75%, 5-100% default, 6-150%, 7-200%, 8-300%, 9-500%, 10-whole page, 11-page width.
  •  lPrinterPref - logical, shows or hides the "Change printer preferences" button in the Preview Toolbar.
  •  nPrinterPropType - numeric, the type of printer preferences dialog (1=PRINTER PROMPT Printer dialog, 2=Current printer properties, 3=New printer dialog in FP, with several new features v3)
  •  nCanvasCount - numeric, the initial quantity of pages rendered on the preview form. Valid values are 1 (default), 2, or 4. Relevant when using ".nPreviewMode=1 (Toolbar).
  •  lShowPageCount - logical, shows / hides the option to change page count in the preview toolbar. Relevant when ".nPreviewMode=1" && toolbar
  •  nButtonSpecialEffect - numeric, different format options for the command buttons in the toolbar: 0=3D; 1=Plain; 2=Hot tracking.
     nButtonStyle - numeric,  0=Default (image file icons 16x16 or 32x32), 1=Custom monochrome icons, 2=Custom Grayscale buttons, better for color transformation. Use ".nButtonForeColor" and "nButtonBackColor" to define the colors. Default = Black.
     nButtonForeColor - numeric, RGB value of the buttons Forecolor. applicable when ".nButtonStyle = 2". (FPv3).
     nButtonBackColor - numeric, RGB value of the buttons BackColor. Applicable when ".nButtonStyle = 2". (FPv3).
     nButtonDisabledColor - numeric, RGB value of the buttons DisabledForecolor. Applicable when ".nButtonStyle = 2". (FPv3).
     nButtonMouseOverColor - numeric, RGB value of the buttons Forecolor when mouse is over them. Applicable when ".nButtonStyle = 2". (FPv3).

Toolbar Appearance

The following properties are applicable only if the property 'nButtonSize = 1' (16x16 pixels). For Images, preferrably send the FULLPATH() of the image. These custom images can't be embedded in your main EXE.
  •  cImgPrint - character, the FullPath of the image file to replace the image of the "Print" button in the preview toolbar.
  •  cImgPrintPref - character, the FullPath of the image file to replace the image of the "Printer Prompt" button in the preview toolbar.
  •  cImgSave - character, the FullPath of the image file to replace the image of the "Save" button in the preview toolbar.
  •  cImgClose - character, the FullPath of the image file to replace the image of the "Close" button in the preview toolbar.
  •  cImgClose2 - character, the FullPath of the image file to replace the image of the "Close" button in the preview toolbar. This 2nd image will be switched in the MouseOver event of the "Close"button.
  •  cImgEmail - character, the FullPath of the image file to replace the image of the "Email" button in the preview toolbar.
  •  cImgSetup - character, the FullPath of the image file to replace the image of the "Setup" button in the preview toolbar.
  •  cImgMiniatures - character, the FullPath of the image file to replace the image of the "Miniatures" button in the preview toolbar.
  •  cImgSearch - character, the FullPath of the image file to replace the image of the "Search" button in the preview toolbar.
  •  cImgSearchAgain - character, the FullPath of the image file to replace the image of the "Search Again" button in the preview toolbar.
  •  cImgSearchBack - character, the FullPath of the image file to replace the image of the "Search Back" button in the preview toolbar.
  •  cImgFirst - character, the FullPath of the image file to replace the image of the "First" button in the preview toolbar. (FPv3)
  •  cImgPrev - character, the FullPath of the image file to replace the image of the "Previous" button in the preview toolbar. (FPv3)
  •  cImgNext - character, the FullPath of the image file to replace the image of the "Next" button in the preview toolbar. (FPv3)
  •  cImgLast - character, the FullPath of the image file to replace the image of the "Last" button in the preview toolbar. (FPv3)
  •  cImgGotoPg - character, the FullPath of the image file to replace the image of the "Go to Page" button in the preview toolbar. (FPv3)
  •  cImgZoomIn - character, the FullPath of the image file to replace the image of the "Zoom In" button in the preview toolbar. (FPv3)
  •  cImgZoomOut - character, the FullPath of the image file to replace the image of the "Zoom Out" button in the preview toolbar. (FPv3)
  •  cImgShare - character, the FullPath of the image file to replace the image of the "Share with external App" button in the preview toolbar. (FPv3)




The following properties are applicable only if the property 'nButtonSize = 2' (32x32 pixels)
  •  cImgPrintBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Print" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgPrintPrefBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Printer Prompt" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgSaveBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Save" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgCloseBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Close" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgClose2Big  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Close" button in the preview toolbar. This 2nd image will be switched in the MouseOver event of the "Close"button. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgEmailBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Email" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgSetupBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Setup" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgMiniaturesBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Miniatures" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgSearchBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Search" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgSearchAgainBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Search Again" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons
  •  cImgSearchBackBig  - character, the FullPath of the 32x32 pixels image file to replace the image of the "Search Back" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons.
  •  cImgFirstBig - character, the FullPath of the 32x32 pixels image file to replace the image of the "First" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons.
  •  cImgPrevBig - character, the FullPath of the 32x32 pixels image file to replace the image of the "Previous" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons.
  •  cImgNextBig - character, the FullPath of the 32x32 pixels image file to replace the image of the "Next" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons.
  •  cImgLastBig - character, the FullPath of the 32x32 pixels image file to replace the image of the "Last" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons.
  •  cImgGotoPgBig - character, the FullPath of the 32x32 pixels image file to replace the image of the "Go to Page" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons.
  •  cImgZoomInBig - character, the FullPath of the 32x32 pixels image file to replace the image of the "Zoom In" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons.
  •  cImgZoomOutBig - character, the FullPath of the 32x32 pixels image file to replace the image of the "Zoom Out" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && big buttons.
  •  cImgShareBig - character, the FullPath of the 32x32 pixels image file to replace the image of the "Share with external App" button in the preview toolbar. Applicable when the property 'nButtonSize = 2' && Big buttons (FPv3)

Output types allowed in the "Save as.." button from the toolbar and context menu
  •  lSaveAsImage - logical, includes the "save as Image" option in the "Save to file" menu
  •  lSaveAsHTML - logical, includes the "save as HTML" option in the "Save to file" menu
  •  lSaveAsMHT - logical, includes the "save as MHTML" option in the "Save to file" menu
  •  lSaveAsRTF - logical, includes the "save as RTF" option in the "Save to file" menu
  •  lSaveAsXLS - logical, includes the "save as XLS" option in the "Save to file" menu
  •  lSaveAsPDF - logical, includes the "save as PDF" option in the "Save to file" menu
  •  lSaveAsTXT - logical, includes the "save as TXT" option in the "Save to file" menu
  •  cOutputPath - character, the destination path used to save the outputs when users click on the "Save As" button in the Report Preview toolbar


Generic Email settings
  •  nEmailMode - numeric, the email type (1=MAPI, 2=CDOSYS HTML, 3=CDOSYS TEXT, 4=Custom procedure, 5=Mapi Alternative, 6=Custom Procedure HTML, 7=PowerScript Mail)
  •  lEmailAuto - logical, Automatically generates the report output file. The file name to be used is determined by the property "cSaveDefName".
  •  cEmailType - character, the file type to be used in Emails (PDF, RTF, HTML, TXT or XLS)
  •  cEmailPRG - character, the name of a PRG that will fire your custom email procedure. In this PRG, you need to receive one parameter, tcFile, that is the temporary output file that you'll send by email. A complete sample, "MYSENDMAIL.PRG" is available, showing you how you can send your emails. To use it, you need to set the value of this property, for instance: .cEmailPrg = "MySendMail.Prg". Relevant when '.nEmailMode=4' && custom procedure. The initial line of the custom PRG should be like "LPARAMETERS tcFile && the temporary outputfile to be sent.
  •  cSaveDefName - character, the default name of the save file. Available in the SAVE AS dialog OR automatically used if '.lEmailAuto=.T.'
  •  cTempDestFile - character, the temporary destination file (image, htm, pdf, etc). Its contents will be wiped after the 1st report run - FP3 will use its default file names aftr run - and this property will be empty at the end of the report session. (FPv3)
     cFaxPRG - character, the custom procedure name responsible for sending faxes. For example: _Screen.oFoxyPreviewer.cFaxPrg = "mySendFax.prg". The initial line of the custom PRG should be like "LPARAMETERS tcFile && the temporary outputfile to be sent.
  • In that case your “MYSENDFAX.PRG” program MUST start with a LPARAMETERS statement, which will receive from FoxyPreviewer some needed parameters to send your fax:
  • FoxyPreviewer does not bring any internal code to manage faxes. With this property, you have a "door" to allow you to receive some info from FoxyPreviewer and send your documents using your Faxing app.
  • _Screen.oFoxyPreviewer.cFaxPrg = “mySendFax.prg”
  • "MYSENDFAX.PRG" program MUST start with a LPARAMETERS statement, that will receive from FoxyPreviewer some needed parameters to send your fax:
  •  
  • LPARAMETERS tcFile, tcFaxNumber, tcHTMLBody, tcSubject
  • * Where:
  • * tcFile = the file name that brings your report
  • * tcFaxNumber = the fax number that your client will fill in the email field in the email form
  • * tcHTMLBody = the text that your client wrote in the email form
  • * tcSubject = the subject filled

CDOSYS EMAIL PROPERTIES
  •  cSMTPServer - character, the SMTP server address. Applicable when ".nEmailMode=2, 3 or 7"
  •  nSMTPPort - numeric, the SMTP port (usually 25). Applicable when ".nEmailMode=2, 3 or 7"
  •  lSMTPUseSSL - logical, determines if the SMTP server requires SSL (security connection). Applicable when ".nEmailMode=2, 3 or 7"
  •  cSMTPUserName - character, the SMTP user name. Applicable when ".nEmailMode=2, 3 or 7"
  •  cSMTPPassword - character, the SMTP password. Applicable when ".nEmailMode=2, 3 or 7"
  •  cEmailTo - character, the destination email. You may use the comma "," separator to send to more than one address
  •  cEmailCC - character, the destination COPY email. You may use the comma "," separator to use more than one address. Applicable when ".nEmailMode=2, 3 or 7"
  •  cEmailBCC - character, the destination BLIND COPY email. You may use the comma "," separator to use more than one address. Applicable when ".nEmailMode=2, 3 or 7"
  •  cEmailReplyTo - character, the email to be used for replies. Applicable when ".nEmailMode=2, 3 or 7"
  •  cEmailSubject - character, the email subject. Applicable when ".nEmailMode=2, 3 or 7"
  •  cEmailBody - character, the email text body. Applicable when ".nEmailMode=2, 3 or 7"
  •  cEmailFrom - character, the email sender information. You may add some custom captions, eg: 'FoxyPreviewer team<foxyteam@hotmail.com>'. Applicable when ".nEmailMode=2, 3 or 7"
  •  cEmailBodyFile - character, the HTML file to be used as email body. Applicable when ".nEmailMode=2, 3 or 7"
  •  lReadReceipt - logical, determines if the e-mail message will ask for a read receipt. Applicable when ".nEmailMode=2, 3 or 7"
  •  lPriority - logical, determines if the e-mail priority level will be high. Applicable when ".nEmailMode=2, 3 or 7"
  •  cEncryptProcedure - character, The programmer can apply his own Scrambling method on the password string (for advanced users). Applicable when ".nEmailMode=2, 3 or 7". Store the PRG/FPW file name to this property and make sure to include 'LPARAMETERS tcStringToScamble' at the beginning of your procedure.
  •  cDecryptProcedure - character, The programmer can apply his own Scrambling method on the password string (for advanced users). Applicable when ".nEmailMode=2, 3 or 7". Store the PRG/FPW file name to this property and make sure to include 'LPARAMETERS tcStringToScamble' at the beginning of your procedure.
  •  cCryptKey - character, the crypt key used to encrypt the SMTP password stored in the settings table (for advanced users). Applicable when ".nEmailMode=2, 3 or 7".
  •  cAttachments - character, the fullpath of the files to be attached to the email message. Use a comma "," as a delimiter between files. Applicable when ".nEmailMode=2, 3 or 7".
  •  cAdressTable - character, the name of the alias or FullPath of a table that contains an address book with emails to be used when sending email messages using the provided form. This table MUST contain a Field of Character type, named "email". Apart from that, it can contain any other data that you want to be visible in a search grid, helping the users to choose the destination. For a better comprehension, please refer to the samples provided and the FAQS. (for advanced users). Applicable when ".nEmailMode=2, 3 or 7"
  •  cAdressSearch - character, optional, the name of the field to be used for making searches. (for advanced users). Applicable when ".nEmailMode=2, 3 or 7" and '.cAdressTable' is used.


PDF general properties (FPv3)
  •  nPDFType - determines the way FoxyPreviewer3 will create the PDF document,
    0, 1 - Default, uses the Haru PDF library. Provides a very compact PDF document, very similar to the original report, allowing several customizations, like encrypting, author, block editing. But is not compatible with non TrueType fonts, such as barfonts, wingdings. May have difficulties dealing with unicode characters as well.
    2 - EMF PDF, uses the Microsoft Print to PDF engine to generate the PDFs. Much faster than Type #1, with 100% of fidelity - that means no line wrap issues, no symbol fonts issues, no unicode issues, no line height issues. The document generated is much larger (600 DPI) and does not allow the customizations listed above.
    3 - EMF Custom, the report is completely redrawn using GDI+ commands, and sent to the PDF Printer, like #2
  •  cPDFPrinter - character, the name of the Microsoft PDF printer in the current machine. By default, windows attributes its PDF printer as "MICROSOFT PRINT TO PDF". But since users can change its name, this property brings the opportunity to inform the new printer name. This is relevant only when ".nPdfType = 2 or 3", that will need this engine to generate the output. 

PDF properties (applicable only when ".nPdfType = 1")
  •  lPDFasImage - logical, the PDF document will generated as an image document when saved from the Preview toolbar save button. The document generated will not be 'searchable' && Default = .F.
  •  nPDFPageMode - integer, determines the Page mode for the PDF document. && Default = 0, 0 = Normal view, 1 = Show the thumbnails pane. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  lPDFEmbedFonts - logical, determines if the PDF engine will embed the true type fonts in the PDF document. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  lPDFReplaceFonts - logical, determines if the PDF engine will replace some basic fonts that are already embedded in any PDF document. Recommended for people using codepage different from 1252 (latin). Default = .T. . Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  lPDFEncryptDocument - logical, determines if the PDF engine will encrypt the PDF document, allowing you to set other restrictions to the documents, using the properties below. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  lPDFCanPrint - logical, determines if the 'encrypted' PDF document will allow printing. Works only if lPDFEncryptDocument = TRUE (see above). Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  lPDFCanEdit - logical, determines if the 'encrypted' PDF document will allow editing. Works only if lPDFEncryptDocument = TRUE (see above). Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  lPDFCanCopy - logical, determines if the 'encrypted' PDF document will allow copying. Works only if lPDFEncryptDocument = TRUE (see above). Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  lPDFCanAddNotes - logical, determines if the 'encrypted' PDF document will allow adding notes. Works only if lPDFEncryptDocument = TRUE (see above). Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  cPDFMasterPassword - character, determines the master password of the 'encrypted' PDF document. Must be different from the 'User Password' property below. Works only if lPDFEncryptDocument = TRUE (see above). Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  cPDFUserPassword - character, determines the user password of the 'encrypted' PDF document. Must be different from the 'Master Password' property above. Works only if lPDFEncryptDocument = TRUE (see above). Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  lPDFShowErrors - logical, determines if error messages during the PDF generation will be raised to the user. Please set this property to TRUE if you are facing some PDF issues, missing fields, etc. This will help find the source of the problem. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  cPdfAuthor - character, the author of the document. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  cPdfTitle - character, the title of the document. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  cPdfSubject - character, the subject of the document. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  cPdfKeyWords - character, the keywords that you want to include in the PDF document. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  cPdfCreator - character, default: "PDFx / FoxyPreviewer". Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  cPDFSymbolFontsList - character, a Fonts list that can't be converted in PDF. Usually, bar codes and symbol fonts. Delimited with commas, eg. "Webdings,Biro". Internally, FoxyPreviewer has already a list of more than 30 fonts that will always be converted to images. Please try first to generate your PDF without adding the font to the list. If it does not render correctly, just add it here! Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated. When using '.nPdfType=2' symbol fonts, graphics, bar codes be exactly the same as shown in the Preview screen.
  •  cPDFDefaultFont - character, the name of the default font name to be used as default in the PDF document. Applicable only when  ".nPdfType = 1" && Haru PDF, deprecated
  •  nPDFLineHeightRatio - numeric, (0.10 - 2), determines the percentage to increase or decrease the line height of PDF documents when you have a CRLF in a field. Default = 1. This is to be used when you feel that for a specific font the line height should be modified. Valid for the Haru PDF documents (.nPdfType = 1, default). When using '.nPdfType=2' the line heights will be exactly the same as shown in the Preview screen.

Excel properties

  •  lExcelRepeatHeaders - Logical, default .F., repeat report page headers in worksheet. Using .F. - False means that only the first report header will be included in the worksheet.
  •  lExcelRepeatFooters - Logical, default .F., repeat report page footers in worksheet. Using .F. - False means that only the last report footer will be included in the worksheet.
  •  lExcelHidePageNo - Logical, default .F., hides report fields that contain "_PAGENO" information.
  •  lExcelAlignLeft - logical, for Excel spreadsheets, Aligns to the left all the string fields.
  • lExcelClearEmptyRows - Logical, eliminates empty rows from the generated XLS document (FP v3)
  • nExcelType - Numeric, the Excel type to generate - 1=XLS (default), 2=XLSX. This is still not mandatory. The user can still determine on each PUTFILE() the extension he deserves and FP3 will create the spreadsheet in the chosen file type (FP v3)
  • lExcelDisplayGridLines - Logical, determines if the gray lines will be displayed between cells. Applicable only in .nExcelType = 2 (XLSX) (FP v3)
  • lExcelAutoHeight - sets the row heights to allow all contents to be shown. For huge reports, this may slow down a little the export process. Applicable only in .nExcelType = 2 (XLSX) (FP v3).
  •  cExcelDefaultExtension - Not applicable, kept for backwards compatibility only. Use the property '.nExcelType' instead.
  •  lExcelConvertToXLS - Not applicable, kept for backwards compatibility only. Use the property '.nExcelType' instead.
  •  nExcelSaveFormat - Not applicable, kept for backwards compatibility only. Use the property '.nExcelType' instead.


Error related
  •  lSilent - logical, Stay silent regarding errors AND write any MESSAGEBOX() to the cErrors property
  •  cErrors - character, brings error messages when lSilent = .F.


Watermark related  (only in Simplified mode)
  •  cWatermarkimage - character, the name of the WM image. Important: this image MUST be stored locally, CAN'T be embedded in your EXE, obligatory property if you want to show the watermark
  •  nWatermarktype - numeric, 1 = Colored (default), 2 = Converts the source image to grey scale, optional property. Default = 1 (Colored).
  •  nWatermarktransparency - numeric, from .10 to 1, default = 0.25, the transparency level of the WM image; 1 = Opaque, optional property. Default = 1 (Opaque)
  •  nWaterMarkWidthRatio - numeric, default = 0.75, the width size in proportion of the watermark in the report page, optional property
  •  nWaterMarkHeightRatio - numeric, default = 0.75, the height size in proportion of the watermark in the report page, optional property

Settings form related  (only in Simplified mode)
  •  cLockedProps  - character, determines the properties that will appear disabled for the users in the "Settings form". A string with the properties separated by a comma. Eg. "cLanguage,cTempFolder,nPdfType". These properties will appear disabled and the user will not be able to change them.


Returned information (Read only properties)
  •  nVersion - numeric, returns the simplified FoxyPreviewer version information.
  •  cVersion - character, returns the detailed FoxyPreviewer version information.
  •  lPrinted - logical, to be checked after the report is run. Tells you if the user printed the current report.
  •  lSaved - logical, to be checked after the report is run. Tells you if the user saved the current report to a file.
  •  lEmailed - logical, to be checked after the report is run. Tells you if the user emailed the current report.
  •  nPageTotal - numeric, the quantity of pages of the current report.

Methods 

  •  SendEmailUsingCDO - Procedure to send any file by e-mail using the FoxyPreviewer properties available for the CDOSYS mode (See "CDOSYS Email properties" above). Just send as parameter the FULLPATH of the file to be sent, and FPv3 will send your file by e-mail. A dialog message will appear telling if the e-mail was sent or not if the Property ".lSilent = .F.". This is a deprecated aproach, since it's not compatible with TLS.
  •  ResetToDefault()
    • Resets the "FoxyPreviewer_Settings.dbf" table to the default settings of FoxyPreviewer, ignoring any changes that were set by the current user
    • eg.: _Screen.oFoxyPreviewer.ResetToDefault()
  •  Release()
    • Releases FoxyPreviewer from memory, resetting all the Printing environment
    • eg.: _Screen.oFoxyPreviewer.Release()
  •  GetFoxyScript()
    • Creates a VFP Script in a TXT that can be sent to ask for support, to help reproducing your environment. Make sure to revise that file and delete any data that is sensitive to your company before sending it to  support.
    • eg.: _Screen.oFoxyPreviewer.GetFoxyScript()
  •  CallSettingsForm()
    • Calls the Settings screen, allowing you to provide your users a way to update the report settings without the need of previewing.
    • eg.: _Screen.oFoxyPreviewer.CallSettingsFormGetFoxyScript()

SPECIAL FEATURES 

FULL JUSTIFIED texts

Add the <FJ> Tag in the User tab in the Report designer
Detailed info: http://weblogs.foxite.com/vfpimaging/2012/02/25/full-justified-texts-in-reports-with-foxypreviewer/

WATERMARKS

Add watermarks to your reports by setting just one property

TAGGED FORMATTING

Draw texts in HTML formatting using the <TF> Tag in the "User"
Detailed info: http://vfpimaging.blogspot.com/2012/02/foxypreviewer-html-like-formatting_5834.html

REPEAT REPORT IN SAME PAGE

You can also print the same report twice in the same page. 
In several cases we need to print some receipts in 2 copies. Normally these reports are small, using only half the page. If you have this situation, you can set just one property, and FoxyPreviewer will repeat the current report in the same page, starting from the half vertical part of the page.
Works only when you run the report in the preview. 
In the preview window, the report will look as original. The 2nd copy will be printed in the same page only when you click the "Print" button in the toolbar or Context menu.
Works only in Simplified mode !
DO FOXYPREVIEWER.APP
_Screen.oFoxyPreviewer.lRepeatInPage = .T.
REPORT FORM YourReport PREVIEW
See also: http://weblogs.foxite.com/vfpimaging/2012/02/02/foxypreviewer-v2-96-updates/

ENHANCED PROGRESSBAR

Use the '.nThermType = 2' property to tell FoxyPreviewer to use the cool progressbar below instead of the original.
FoxyPreviewer enhanced Progressbar

SENDING BY EMAIL

Email types and configurations
Email sending form for CDOSYS

CONFIGURING AT RUNTIME

Settings dialog

 AUTOMATING WITH INTELLISENSE


  • Simplified mode


Immediately after you Initialize FoxyPreviewer with "DO FOXYPREVIEWER.APP", it will insert an object to the "_Screen", that will allow you to change every configuration. This object will be available immediately, and you can consult it every time, using Intellisense, like below. Notice that the captions of the properties are shown correctly as well:




TRANSLATING TO NON ENGLISH LANGUAGES

As listed above, the property cLanguage allows you to change the language that all dialogs, forms, TitleBars and tooltips appear.
The default language is ENGLISH, and right now we have 27 available: English, Portuguese, Spanish, French, German, Greek, Turkish, Czech, Persian, Arabic, Italian, Indonesian, Polish, Swahili, Russian , Simplified Chinese , Traditional Chinese , Dutch, Bulgarian, Hungarian, Kazakh, Serbian, Croatian, Slovak, Latvian and Hebrew.

Special tweaks were applied to allow exporting to double-byte languages, such as Chinese and Japanese.

To set the language, you may pass the English language name or the local language name, for example, to change the language to Spanish or French:

_Screen.oFoxyPreviewer.cLanguage = "SPANISH"

_Screen.oFoxyPreviewer.cLanguage = "FRENCH"
_Screen.oFoxyPreviewer.cLanguage = "FRANÇAIS"

Some of the languages are not updated. Feel free to send to vfpimaging at hotmail dot com your updated translations, or even introduce a new language ! I'll be happy to update the localizations table in the future updates.

You can also use your own Localizations table adapted to your needed CodePage. Just store the FoxyPreviewer_Locs.Dbf file at the same locations of FoxyPreviewer.App and FP3 will use it instead of the embedded table. More information at FAQS#26

Get the latest FoxyPreviewer Locs.dbf available and update it to fit your needs. Please send it to vfpimaging at hotmail dot com so that your language will be updated for the next releases.


DISTRIBUTION

FoxyPreviewer consists of a set of separate utilities, that were adapted to work together.
These files include classes, prgs, images, dlls and header files.

In order to simplify the distribution and to avoid adding many individual files to your project, all the related files have been compiled into a single APP file - FoxyPreviewer.App

The usage is simple:

1 - Simplified mode:
Just store the FoxyPreviewer.App file somewhere at the LOCAL disk, in a place that can be found by your executable. Make sure to make "SET PATH" include that folder.
DON'T embed this file in your project. If you want make sure to mark this file as "Excluded"



If you don't want to use a separate APP file, you can have FoxyPreviewer included in your project normally. 

Make sure to include all classes, VCX/VCT, images, the header files (*.H), the dialog forms, the file FoxyPreviewer.Prg in your Project, except the file LIBHPDF.DLL and compile. That's all. All these files are in the "Source" folder of FoxyPreviewer. There will be just one single file to take an extra care: LIBHPDF.DLL, that you need to distribute separately, in order to allow the PDF generation. Your EXE will not be able to use the functions of the DLL if it is not stored at any disk location.

Then, instead of calling FoxyPreviewer.App, you'll call Foxypreviewer.PRG

BUT:
THIS IS NOT RECOMMENDED !
That's because FoxyPreviewer is under constant development, and changes, fixes, enhancements may be applied very soon. When that happens, you'll need to update all the sources in your project. So, the recommended is to use just the APP, and distribute it separately. That way, you wont need to update your EXE when a new Version of FoxyPreviewer is released.

USING THE ADRESS BOOK TO SEND EMAILS

Adress book form

The adress book form contains a grid that will bring all the fields provided by your cursor or table, so please make sure to send only the fields that you want to appear. The grid brings some facilities:
- Column reorder by double-clicking at the column header (Thanks to Paul Mrozovsky, with his RCS Grid reorder class)
- The search field can be changed by right-clicking at the column header
- Selecting all the adresses, or inverting the selections, by clicking at the 1st column header

Just create a cursor or table, containing an obligatory field called "email", and set a property in the FoxyPreviewer object telling the name of the Alias / Cursor or path to access that table.

The command below creates a table using the Customers table that comes with VFP, adding the "email" field, that originated the abopve adress book:

* Creating a table with the adress book
SELECT CAST(LOWER(GETWORDNUM(Contact, 1, " "))+"@vfp4.com" AS C(30)) AS email,* ;
   FROM (_samples + '\data\customer') ;
   WHERE .T. INTO TABLE c:\Test2.DBF READWRITE

Next step is to tell FoxyPreviewer the name of your table!
*' Setting the global properties
DO FoxyPreviewer.App
_Screen.oFoxyPreviewer.cAdressTable  = "c:\Test2.dbf"
_Screen.oFoxyPreviewer.cAdressSearch = "Contact"                 &&' Optional
_Screen.oFoxyPreviewer.cEmailTo      = "test@foxypreviewer.org"  &&' Optional
_Screen.oFoxyPreviewer.nEmailMode    = 2 && CDO/HTML

REPORT FORM YourReport PREVIEW

Adress book form

As the dialog image above said, you first need to configure your email SMTP. This can be done using the Settings dialog, at the Email Tab. Make sure to select CDO-HTML and provide your SMTP server info.
Obviously, you can also set the according properties directly, or even edit the Settings table, providing the needed information.
Please refer to the documentation page of FoxyPreviewer for more detailed information about the properties needed for setting your email. There are several pictures available to ease things for you. 

ABOUT THE OUTPUT TYPES AVAILABLE

  • PDF - The PDF Engine is run by the LibHaru library, originally created by Takeshi Kano. FoxyPreviewer, during the first run will install the file libhpdf.dll in the same folder of FoxyPreviewer.App . The PDFS generated can be opened by any PDF reader application. THe PDF engine allows lots of customizations. Please refer to the properties available in this document, or use the Settings form to change these definitions interactively.
  • RTF - The RTF generated is very rich, and the result is really very close the the original report. It can be viewed using MS Word, MS Word Viewer (freeware), OpenOffice Writer and other tools.
  • XLS - The Excel output is somehow tricky. In fact, the output generated is not a pure Excel (XLS) type. That's a rich XML type that "MS Excel" and "OpenOffice Calc" can open without any pain. Excel 2003 can open these files normally, but newer versions will probably show a dialog saying that the file is in a wrong format. Just ignore and tell it to try to open and the worksheet will be opened. OpenOffice Calc needs that these files use the XML extension.
  • HTML -  uses some very basic HTML CSS Style commands to generate the output, with a very good result, and without any external library.
  • IMAGE Types - FoxyPreviewer allows you to save your reports as images. Just select the desired extension in the PUTFILE dialog, or using the cDestFile property directly, and it will generate the image according to that extension. For TIFFs, Multipage one single Multipage image file will be generated for the current report. For all the other types, that don't allow multipages, several images, one for each page of he report will be generated, with the suffix of the page number in the file name.
  • TXT - Reproduces a Plain TXT of the report.

FAQS:

How can I generate a PDF (or any other available type) without opening the preview window ?

    • In FP v3
Just use the "TO FILE" clause, and FPv3 will use the File extension used to determine automatically the best reportlistener to create your output! In short, in the new version you don't need to use the "OBJECT TYPE" clause at all!
DO FoxyPreviewer.App
* Make PDF
REPORT FORM (_Samples + "\Solution\Reports\Wrapping.frx") ;
   TO FILE "c:\TestReport.Pdf" ; &&' Destination
   PREVIEW && Open the default PDF viewer - optional clause

    • Using the REPORT FORM .... OBJECT TYPE nType Clause
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 (not recommended for people who work with languages with double-byte characters) 
  • 15 = HTML  - Generates simplified HTML outputs. Good to be used in websites, no need of MSXML, faster rendering and Double-byte languages friendly
  • 20 = Renders all FoxyPreviewer available file types in one single ReportListener. Just pass the File name and file extension in the "TO FILE" clause, and FOxyPreviewer will render the output according to the file extension passed. Extensions allowed: PDF, RTF, DOC, XLS, XML, HTM, HTML, MHT, "BMP", "BITMAP", "GIF", "JPG", "JPEG", "TIF", "TIFF", "PNG", "EMF"
DO LOCFILE("FoxyPreviewer.App")
* Make PDF
REPORT FORM (_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


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
http://http://code.msdn.microsoft.com/KB968409/Release/ProjectReleases.aspx?ReleaseId=2445

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.com


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 !

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.
Unfortunately there is nothing to do, except:

- 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:
DO FOXYPREVIEWER.APP WITH "Release" 
or
_Screen.oFoxyPreviewer.Release()


Another simple option, without releasing FP:
SET REPORTBEHAVIOR 80 

To reactivate, it is more than simple, since FP was still loaded in memory:
SET REPORTBEHAVIOR 90



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. 


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

This happens because you are probably using an old 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:



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
http://www.microsoft.com/downloads/en/details.aspx?FamilyId=320B6438-BE76-48C7-A68E-1792E2AA3BF2&displaylang=en
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.


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
DO FOXYPREVIEWER.APP WITH "Release"
This will restore the SET PROCEDURE, SET CLASSLIB, Extension handler, and PreviewContainer


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 fileFoxyPreviewer.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:
DO FOXYPREVIEWER.APP WITH "c:\myApp\Users\John"

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.
ENDWITH 


When I click on the "Save" button at the preview toolbar, the file options menu does not appear - (Thanks to Hernan Cano and 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.


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 = NEWOBJECT("FOXYLISTENER", "PR_REPORTLISTENER.VCX", "FoxyPreviewer.App")
loListener.ListenerType = 0 && Set the listener to "Printing" mode
REPORT FORM YourReportWithFJ TO PRINTER OBJECT loListener && Call the report normally



When I run my report some strange text is echoed to the screen as if a mysterious SET TALK ON had been issued.

Cathy Pountney has already posted about this issue: SET TALK appears to be on when running reports with SP2



This issue should not appear in the most recent versions of FoxyPreviewer, because it fixes the original VFP9 report engine. If for any reason you need to use a deprecated version, make sure to use the most recent versions of the Report.App files at the FoxyPreviewer downloads page. There you'll find the correct versions for you to download directly. 


My PDFs show some strange "open boxes" when there are CRLF characters - CHR(13) + CHR(10) in fields



This is a known issue in the PDF library, external to FoxyPreviewer. To avoid this issue, make sure to set the property "lEmbedFonts = .F."



My PDF is too big!

Try setting the property "lEmbedFonts = .F."



Images are not appearing in my Excel documents

The Worksheets engine uses the Excel XML format, that unfortunately does not support images.



in Excel documents, some fields are in the wrong column, or misaligned, or missing

The issue is related to the original alignment of the FRX. Make sure to align the title labels with the fields below them, that contain the values.

Open your report, and change the "x" cordinate position of the label titles, and make new tests with the XLS output, and you'll probably find a good position.
In fact, there is no missing values, but they are not aligned.
The best to do is to use the menu "Format-Align", to make sure all the needed fields are correctly aligned.


How to set a password to my PDF document?

You need to setup at least 3 properties: 'lPDFEncryptDocument = .T.' , 'cPdfMasterPassword = "YourPwd1", 'cPDFUserPassword = "YourPwd2" . To encrypt a document, you ALWAYS need to setup 2 different passwords! One for the "Master", and the other for the "User" passwords. Check the related properties in the documentation for more details.

DO FoxyPreviewer.app
_Screen.oFoxyPreviewer.lPDFEncryptDocument = .T.
_Screen.oFoxyPreviewer.cPDFUserPassword = "pwdmaster"
_Screen.oFoxyPreviewer.cPDFMasterPassword = "pwduser"
REPORT FORM (ADDBS(_Samples) + "SOLUTION\REPORTS\PERCENT.FRX") OBJECT TYPE 10 TO FILE "c:\Test1.pdf" PREVIEW


How to save my reports as Image files ?

  • Simplified Mode
DO Foxypreviewer.App
REPORT FORM (ADDBS(_Samples) + "Solution\Reports\colors.FRX") OBJECT TYPE 20 TO FILE "Colors.PNG"

  • Alternative Mode (for advanced users)
DO Foxypreviewer.App
LOCAL loListener AS ReportListener
loListener = CREATEOBJECT("FoxyListener")
loListener.ListenerType = 3
REPORT FORM (ADDBS(_Samples) + "Solution\Reports\colors.FRX") OBJECT loListener

LOCAL lnFileType
   && 100 - EMF
   && 101 - TIFF
   && 102 - JPEG
   && 103 - GIF
   && 104 - PNG
   && 105 - BMP
lnFileType = 104 && PNG

FOR lnPage = 1 TO loListener.PageTotal 
   loListener.OutputPage(lnPage, "c:\Test" + ALLTRIM(STR(lnPage)) + ".png", lnFileType)
ENDFOR 
loListener = NULL


My reports are correctly showing in Preview, but they are not being printed at the desired printer, or are taking too much time to begin printing.

Make sure to UNMARK the option “Save Printer Environment” of your reports. If marked, the printing engine will force the printing to that Printer environment. If that printer is not available, the report will not print.

From VFP9 Help file: "Sometimes you design a report always to be printed in a single environment, requiring settings specific to a single printer. In this case, you can opt to save the Printer Environment with your report. Even in such a case, however, it is often better practice to omit the printer environment settings from the report or label definition file (frx or lbx)."





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:

FUNCTION IsGdipFont

LPARAMETERS tcFont
* The Gdi+ API declarations were "Aliased" to avoid problems with other possible Gdi+ classes 
* working at the same time
* GDI+ Initialization and Shutdown
DECLARE LONG GdiplusStartup IN GDIPLUS.DLL ;
   AS FBC_GdiplusStartup ;
   LONG @ token, STRING @ INPUT, LONG @ OUTPUT

DECLARE LONG GdiplusShutdown IN GDIPLUS.DLL ;
   AS FBC_GdiplusShutdown ;
   LONG token


* FontFamily functions
DECLARE INTEGER GdipCreateFontFamilyFromName IN GDIPLUS.DLL ;
   AS FBC_GdipCreateFontFamilyFromName ;
   STRING familyname, INTEGER FontCollection, INTEGER @FontFamily

DECLARE INTEGER GdipDeleteFontFamily IN GDIPLUS.DLL ;
   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+
ENDIF

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)
ENDIF 

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

RETURN llCanUse