ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Report editor / Printing in WEBDEV
  • Overview
  • How to?
  • 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
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?

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).
    For details on how to create a unique file name, see Defining a unique name for the generated file.
  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, fFile + fExtension)
// Send the file to the browser
PageDisplay(FileName)
Remark: The HTML file can be directly opened from a button or from a link. Simply change the control action with the URL property:
// 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, fFile + fExtension)
// Modify the action of the Link control that will open the HTML file
LINK_HTMLLink.URL = "/" + FolderWeb() + "/" + FileName
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 08/31/2022

Send a report | Local help