Printing a Report to a RTF or HTML File

Question:
Can you create a HTML or RTF file in Visual FoxPro? If so, how?

Answer:
VFP comes with a program (called GENHTML.PRG) that can generate HTML from many different sources: tables, reports, menus, forms, etc.

VFP keeps the name and path of this program in a system memory variable called _GENHTML. You can view the code by executing the following command from the command window:
MODIFY COMMAND (_GENHTML)

Here is the list of parameters for _GENHTML:

  • cOutFile: Specifies the name of the output .HTM file. If a filename without an extension is specified, .HTM is used.
  • vSource: Specifies the source filename, alias, or object (can pass the name of a table, screen, report, menu, or an object).
  • nShow:
    • 0/.F./Empty = Generate output file only
    • 1 = Create output file and view generated file
    • 2 = Create output file and show generated file in Internet Explorer
    • 3 = Create output file and show based on Save As HTML dialog selection
    • 4 = Create PUBLIC _oHTML object and generate file
    • 5 = Create PUBLIC _oHTML object without generating file
  • vIELink: Specifies a link to Internet Explorer object or Web browser control:
    • F./Empty = No link is created
    • .T. = Automatically creates instance of Internet Explorer
  • cStyle: Specifies Style ID reference in GenHTML.dbf.
  • cScope: Specifies the scope of scan by setting .cScope.
  • cHTMLClass: Specifies the class and, optionally, the class library and module that is instantiated for HTML object.

So to send a report named MyReport.FRX to an .HTM file named MyHTML.HTM and show it in Internet Explorer, execute the following command:

DO (_GENHTML) WITH "MyHTML.HTM","MyReport.FRX",2

The cStyle parameter allows you to apply style sheets to the generated text.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS

homes in the real estate industry

Exploring the Latest Tech Trends Impacting the Real Estate Industry

The real estate industry is changing thanks to the newest technological advancements. These new developments — from blockchain and AI to virtual reality and 3D printing — are poised to change how we buy and sell homes. Real estate brokers, buyers, sellers, wholesale real estate professionals, fix and flippers, and beyond may