The textReport.terminateReport() function passes control of the printing to the report engine to stop the report generation process. This function ends output with the last row that is generated before the function is called. No handler functions are called and no footer is printed on the last page. The engine finishes by closing the output file.
textReport.terminateReport()
The following sample code terminates the report:
myReport TextReport = new TextReport();
...
myReport.terminateReport();