Report
- Last UpdatedOct 29, 2026
- 2 minute read
Report is a built-in function that executes the specified Report worksheet and sends the output to hard disk, printer, or PDF.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
Report |
Module Activity |
Synchronous |
No |
Supported |
Supported |
Not supported |
Supported |
Executed on Server |
Syntax
Report("strFunction",optNumOrientation)
Report ( " strFunction " { | ,optNumOrientation } )
strFunction
A string specifying the operation to perform and the Report worksheet to output, using the syntax "Operation:worksheet".
Operation must be one of the following:
|
Value |
Description |
|---|---|
|
Disk |
Save file to hard disk. |
|
Prn |
Send report to default printer. |
|
|
Generate a PDF file of the report. |
worksheet is the name of the Report worksheet file ( *.rep ) to be executed. The file name cannot contain spaces. If it does, save the worksheet again with a new name.
Note: Follow the conventions of the target platform for the file path and name, and separators. For example, a file path in Windows starts with a drive letter and uses backward slashes as separators (C:\path\to\file), while a file path in Linux starts at the root directory and uses forward slashes as separators (/path/to/file).
optNumOrientation
The orientation of the output:
|
Value |
Description |
|---|---|
|
0 |
Portrait |
|
1 |
Landscape |
This parameter is optional; if no value is specified, the default value is 0 (portrait). Also, this parameter is ignored if Operation is other than Prn.
Returned value
This function returns one of the following possible values:
|
Value |
Description |
|---|---|
|
0 |
Success. |
|
1 |
strFunction is configured with a numeric value (invalid). |
|
2 |
strFunction does not contain ":" (invalid). |
|
3 |
strFunction contains an invalid output type before the ":". |
|
4 |
Background Task is not running (see tip below). |
|
5 |
Disk error (for example, disk full, read-only file cannot be overwritten, or invalid path). |
|
6 |
Specified Report worksheet file does not exist. |
Tip: The Background Task must be running in order to execute this function. Otherwise, the operation will not be executed and the function will return the value 4 indicating error. For more information, see Runtime Tasks.
Notes
Some features of this function are not supported in projects running on Windows Embedded target systems: it cannot generate PDF or send to printer (that is, it can only save to disk); it cannot change paper orientation using the optNumOrientation parameter; and it does not support Report worksheets in RTF format.
This function is based on legacy code, which means it cannot use printer settings that were previously configured by the PrintSetup function. Instead, it always uses the default printer on the computer or device that hosts the project runtime. You can use VBScript in your project to change the default printer in Windows; for example:
Examples
Execute Report1 and save it to hard disk:
Report("Disk:Report1.rep")
Execute Report2 and send it to the default printer, using portrait orientation:
Report("Prn:Report2.rep",0)
Execute Report3 and send it to the default printer, using landscape orientation:
Report("Prn:Report3.rep",1)
Execute Report1 and generate a PDF:
Report("Pdf:Report1.rep")