Printing a Report to a RTF or HTML File

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:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing