Источник:
http://dev.goshoom.net/en/2018/10/pr...ode-in-d365fo/
==============
A comment below my blog post
Printing reports from code in AX2012 asked me to provide an example for D365FO. Here is it.
The code is virtually identical. Only writing a file to a shared folder doesn’t make a good sense in cloud, therefore I changed the code to return the file to user for download.
SrsReportRunController controller = new SrsReportRunController();SysUserLicenseCountRDPContract rdpContract = new SysUserLicenseCountRDPContract();SRSPrintDestinationSettings settings; // Define report and report design to usecontroller.parmReportName(ssrsReportStr(SysUserLicenseCountReport, Report));// Use execution mode appropriate to your situationcontroller.parmExecutionMode(SysOperationExecutionMode::Synchronous);// Suppress report dialogcontroller.parmShowDialog(false); // Explicitly provide all required parametersrdpContract.parmReportStateDate(systemDateGet());controller.parmReportContract().parmRdpContract(rdpContract); // Change print settings as neededsettings = controller.parmReportContract().parmPrintSettings();settings.printMediumType(SRSPrintMediumType::File);settings.fileFormat(SRSReportFileFormat::Excel);settings.fileName('UserLicenseCount.xlsx'); // Execute the reportcontroller.startOperation();
Источник:
http://dev.goshoom.net/en/2018/10/pr...ode-in-d365fo/