PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US

  • Principle for printing a report
  • Report with lower and upper bounds
  • Running a query and report based on this query
  • Print destination
  • Passing parameters
  • Printing a component report
  • RPC and independent HFSQL context
  • Nested reports
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
Prints a report created with the report editor.
Caution: The WLanguage code required to print the report depends on the data source of report. For more details and examples, see:
Versions 15 and later
Linux The reports are available in PDF format in Linux. See Printing in Linux for more details.
New in version 15
Linux The reports are available in PDF format in Linux. See Printing in Linux for more details.
Linux The reports are available in PDF format in Linux. See Printing in Linux for more details.
Versions 18 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 18
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.

Important

With Reports & Queries, you have the ability to print a report:
  • by starting a print ( ).
  • by running the report test ( ).
Therefore, no programming is required to print the report.
In order for the reports created in Reports & Queries to be directly printed from a WINDEV application, this feature must be implemented by the provider of the WINDEV application.
The provider can for example include a window allowing the end user to:
  • select a report created in Reports & Queries.
  • run this report.
Note: From version 19, HFSQL is the new name of HyperFileSQL.
// Simple print on printer
iPrintReport(RPT_Invoice)
WINDEVReports and QueriesUser code (UMC)
// Print with print preview
iPreview(i100)
iPrintReport(RPT_Invoice)
WEBDEV - Server code
// Create a unique file name
MyUniqueFile is string = fDataDir() + "\" + DateSys() + TimeSys() + ".pdf"
// Destination of the report: Print the report in a PDF file
iDestination(iPDF, MyUniqueFile)
// Print the report based on "TABLE_CustomerTable"
iPrintReport(RPT_CustomerTable)
// Display the report in PDF format
FileDisplay(MyUniqueFile, "application/pdf")
// Delete the file
fDelete(MyUniqueFile)
Syntax
[<Result> =] iPrintReport(<Report Name> [, <Parameter 1> [, <Parameter 2> [, ...]]])
<Result>: Type of result returned by the report (optional)
Versions 20 and later
Value returned by printing the report. This value is returned:
  • by the RESULT keyword found in the closing code of the report.
  • by ..ReturnedValue used before closing the report.
New in version 20
Value returned by printing the report. This value is returned:
  • by the RESULT keyword found in the closing code of the report.
  • by ..ReturnedValue used before closing the report.
Value returned by printing the report. This value is returned:
  • by the RESULT keyword found in the closing code of the report.
  • by ..ReturnedValue used before closing the report.
<Report Name>: Character string (with or without quotes)
  • Logical name of report, defined in the report editor.
  • Physical name of report (including its path) if the compiled code is included in the report.
WEBDEV - Server code This parameter must correspond to the logical name of report.
<Parameter 1>: Optional parameters (the type corresponds to the parameter type)
Optional parameter expected by the report. This parameter was defined in the opening code of report. This parameter can be the name of a view, the name of a memory zone, etc.
Caution: If lower bounds and upper bounds have been specified for the report, the first two parameters must correspond the lower bound and to the upper bound (respectively).
<Parameter 2>: Optional parameters (the type corresponds to the parameter type)
Optional parameter expected by the report. This parameter was defined in the opening code of report. This parameter can be the name of a view, the name of a memory zone, etc.
Caution: If lower bounds and upper bounds have been specified for the report, the first two parameters must correspond the lower bound and to the upper bound (respectively).
Remarks

Principle for printing a report

iPrintReport reads the data source of report (data files, query, Table control, ...). iPrintReport prints the Body block for each record. The other blocks are printed when necessary:
  • The Start of document block will be printed at the beginning of document.
  • The End of document block will be printed at the end of document.
  • The Page header block will be printed at the top of each page.
  • The Page footer block will be printed at the bottom of each page.
  • If there is a break, the Body block of the break will be located between the Break header block and the Break footer block.

Report with lower and upper bounds

If lower and upper bounds have been specified when the report was created in the report editor, the two first parameters passed to the report via iPrintReport must correspond to the lower bound and to the upper bound (respectively).
Example: a report was created on Customer file. This report browses the file on the "CustomerNum" key item. This report was defined as being bounded, the minimum and maximum bounds being supplied ("Data" tab of description window of report.
The following code is used to print the report for customers 2 to 5:
iPreview()
iPrintReport(RPT_Customer_Prospects, "2", "5")

Running a query and report based on this query

When printing a report based on a query, the query is not re-run if it was already run. To force the query to be re-run (addition of records for example), you must use HExecuteQuery or iInitReportQuery.

Print destination

The destination of report print can be chosen via iPreview and iDestination.
WINDEV iPreview is used to perform a print preview. To find out whether the print was performed from the preview, use iDocumentPrinted.
WINDEVWEBDEV - Server codeiPhone/iPadWindows MobileUniversal Windows 10 AppAjaxUser code (UMC)

Passing parameters

The parameters specified by iPrintReport correspond to the parameters defined in the opening code of report via the following syntax:
PROCEDURE <ReportName> (<NameParam1>, <NameParam2> = "<DefaultValue>", ...
<NameParamN> = "<DefaultValue>")
Reminder: Some of the parameters passed to a procedure can be optional parameters. When declaring the procedure, the optional parameters must be described in last position (on the right), with a default value preceded by the "=" sign. See Parameter of a procedure for more details.
If the report is based on a query, iInitReportQuery must be used to pass the query parameters before printing the report.

Printing a component report

To print a component report, use the name of component report (the component being included in the project). For example:
iPrintReport(ComponentReport)
If a conflict occurs with a project element, the element name must be prefixed by the component name. For example:
iPrintReport(MyComponent.Report)
To use the report name in a variable, specify the component name. For example:
sReport is string = "MyComponent.MyReport"
iPrintReport(sReport)
WINDEVReports and QueriesWindows MobileUser code (UMC)

RPC and independent HFSQL context

The access to a HFSQL data file in RPC is not allowed from a report with an independent context.
The "Independent HyperFileSQL context" option must be disabled.
To disable this option in a report, uncheck "The report execution does not affect the browse operations (independent HyperFileSQL context)" in the "Data" tab of report description.
The "Independent HFSQL context" option must be disabled.
To disable this option in a report, uncheck "The report execution does not affect the browse operations (independent HFSQL context)" in the "Data" tab of report description.
In an application that is using the remote access, if independent contexts must be used, they must be programmed by HSavePosition and HRestorePosition.
Note: The contexts cannot be copied in RPC. You must use HOpenAnalysis or HConnectRemoteAccess in the new context to access the RPC.

Nested reports

You have the ability to call iPrintReport within the same report. See the help about the Nested reports for more details.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230etat.dll
Windows Mobile wp230etat.dll
Linux wd230etat.so
Minimum required version
  • Version 9
This page is also available for…
Comments
Imprimir Numero Nota Fiscal/Danf - 000.001.500.
Aula 1051 - WinDev Relatorio - 041/... - Imprimir Numero Nota Fiscal/Danf - 000.001.500.

iPreview(iapZoom100)
//Vai Mostrar Relatorio Na Tela
iPrintReport(ETAT_Relatorio_Teste)
//Imprimir Relatorio

//Blog com Video e Exemplo

http://windevdesenvolvimento.blogspot.com.br/2017/01/aula-1051-windev-relatorio-041-imprimir.html

https://www.youtube.com/watch?v=3LFsSZwUY5w


De matos
Feb. 01 2017
Exemplo Intervalo Código
Exemplo Intervalo Código

iPreview(ipvZoom100)
IF CBOX_imprimirTodos=True THEN
iPrintReport(RPT_bancos_shared)
ELSE
iPrintReport(RPT_bancos_shared,EDT_BancoInicial,EDT_BancoFinal)

END

//Blog com Video e Imagen

http://windevdesenvolvimento.blogspot.com.br/2016/10/aula-947-windev-curso-relatorio-32.html

https://www.youtube.com/watch?v=yHZbC-bTrRU

De matos
Oct. 21 2016