How to: Print a Range of Pages from a Report (MorphX Reporting Tools)

Print a specified range of pages from a report by using the PrintJobSettings.allPages, PrintJobSettings.from, and PrintJobSettings.to methods.

Example


In the following example, pages 2–4 from a report are printed to a .pdf file. The ReportRun.setTarget method specifies a file as the print medium. The printJobSettings.format and printJobSettings.fileName methods specify the file format and the file name.

other

Copy

static void printToPDF(Args _args)
{
Args args;
ReportRun rr;
str reportName = 'Cust';
;

args = new Args(reportName);

rr = new ReportRun(args,'');

rr.setTarget(Printmedium::File);
rr.printJobSettings().format(PrintFormat::PDF);

rr.printJobSettings().fileName("C:\\Cust_ReportRange.pdf");

rr.printJobSettings().allPages(false);
rr.printJobSettings().from(2);
rr.printJobSettings().to(4);

// Disables forms that enable users to modify
// the report query and print settings.
rr.query().interactive(false);
rr.report().interactive(false);

rr.run();

}

No comments:

Post a Comment