2013年3月17日星期日

How to force using code printing ranges on report


Business Requirement: printing ranges on a report

This code will be used for print the report ranges in the page header, like if you mark the "Print ranges" checkbox of report print options:

Printing the ranges with which a Report has been executed is only available for a AutoDesignSpecs Design of a Report.


 

Unfortunately this option is not available for Reports having a Generated Design.

Solution: override executeSection method in PageHeader


You can print the ranges with some X++ code modifications in your report.

  1. Add a PageHeader control to the Report, if there isn’t yet such a control in your Report.
  2. Override the executeSection method of the PageHeader control as follows:
    
    public void executeSection()
    {
      // BGN Printing ranges
      SysReportRun locSysReportRun;
      ;
      //END
    
      super();
    
      // BGN Printing ranges
      locSysReportRun = element;
      locSysReportRun.printRanges(true);
      SysReportRun::executePrintRangeSection(element);
      // END
    }

没有评论:

发表评论