|
|
|
|
|
- Overview
- How to?
- Generating an HTML file on the Web server
- Displaying the HTML file
- Deleting an HTML file
- Example
Displaying a report in HTML format in the browser of the Web user
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.
Generating an HTML file on the Web server To generate an HTML file on the Web server: - 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. - If the report contains images, specify that these images must be generated in the "<MyProject>_WEB" directory of the site (iDirImageHTML).
- Configure the print destination with iDestination associated with the iHTML constant (print in an HTML file).
- 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: - Extract the name and extension of the generated file with fExtractPath.
- Display the generated file in the browser of the Web user with FileDisplay or PageDisplay.
To display the generated file upon request, you must: - Extract the name and extension of the generated file with fExtractPath.
- 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. 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|