PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Overview
  • How to proceed?
  • Generating an HTML file on the Web server
  • Displaying the HTML file
  • Deleting an HTML file
  • Example
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Displaying a report in HTML format in the browser of the Web user
Overview
To display a report in HTML format in the browser of the Web user, you must:
  • generate the HTML file on the Web server.
  • display the generated file in the browser of Web user. The display of the file can be:
    • immediate.
    • requested by the web user (click performed on a link for example).
  • delete the HTML file from the Web server.
How to proceed?

Generating an HTML file on the Web server

To generate an HTML file on the Web server:
  1. Create a unique name for the HTML file to generate. The creation directory of this file must be accessible in read/write (the directory of the data files or the "<MyProject>_WEB" directory of the site for example).
    See Defining a unique name for the generated file for more details.
  2. If the report contains images, specify that these images must be generated in the "<MyProject>_WEB" directory of the site (iDirImageHTML).
  3. Configure the print destination with iDestination associated with the iHTML constant (print in an HTML file).
  4. Specify the name of the report to print in iPrintReport.
    The HTML file is created on the Web server.

Displaying the HTML file

The display of the file can be:
  • immediate.
  • requested by the web user (click performed on a link for example).
To automatically display the generated file in the browser of the Web user, you must:
  1. Extract the name and extension of the generated file with fExtractPath.
  2. Display the generated file in the browser of the Web user with FileDisplay or PageDisplay.
To display the generated file upon request, you must:
  1. Extract the name and extension of the generated file with fExtractPath.
  2. Display the generated file in the browser of web user. You can for example:
    • use FileDisplay or PageDisplay.
    • modify the URL of the control that displays the HTML file (..URL property of a button or link for example).
    • ...

Deleting an HTML file

To reduce the size occupied by the reports in HTML format on the Web server, we recommend that you delete the useless reports on a regular basis. You can create a procedure used to delete all the reports created during the day for example.
Caution: Don't delete the report immediately after FileDisplay or PageDisplay. The generated HTML file must exist in order to be viewed on the browser of the Web user.
Example
The "RPT_InvoiceHTML" report is displayed in HTML format on the computer of the Web user.
The "ShowInvoice" button is used to:
  • generate the HTML file in the "<MyProject>_WEB" directory of the site.
  • view the report in HTML format.
In this example, the server click code of the "ShowInvoice" button is as follows:
// Generate a unique HTML file name
FilePath is string  
FilePath = fWebDir() + "\" + DateSys() + TimeSys() + ".htm"
// Configure the destination of the print
iDestination(iHTML, FilePath)
// Print the RPT_InvoiceHTML report
iPrintReport(RPT_InvoiceHTML)
// Extract the name and extension of the generated file
FileName is string
FileName = fExtractPath(FilePath, fFileName + fExtension)
// Send the file to the browser
PageDisplay(FileName)
Note: The HTML file can be directly opened from a button or from a link. All you have to do is modify the action of this control with ..URL:
// Generate a unique HTML file name
FilePath is string  
FilePath = fWebDir() + "\" + DateSys() + TimeSys() + ".htm"
// Configure the destination of the print
iDestination(iHTML, FilePath)
// Print the RPT_InvoiceHTML report
iPrintReport(RPT_InvoiceHTML)
// Extract the name and extension of the generated file
FileName is string  
FileName = fExtractPath(FilePath, fFileName + fExtension)
// Modify the action of the Link control that will open the HTML file
LINK_HTMLLink..URL = "/" + FolderWeb() + "/" + FileName
Minimum required version
  • Version 9
Comments
Click [Add] to post a comment