다음을 통해 공유


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

Important

This content is archived and is not being updated. For the latest documentation, see Microsoft Dynamics 365 product documentation. For the latest release plans, see Dynamics 365 and Microsoft Power Platform release plans.

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

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.

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();

}

See also

How to: Specify Printers for Reports (MorphX Reporting Tools)