Quantcast
Channel: Microsoft Dynamics AX
Viewing all articles
Browse latest Browse all 130240

Blog Post: Printing reports from code in AX2012

$
0
0

How to print a report from X++ and change print settings in AX2012?

I have a concrete example for you – it should give a good idea how to do that even if your situation is a little bit different.

SrsReportRunController          controller =new SrsReportRunController(); SysUserLicenseCountRDPContract  rdpContract =new SysUserLicenseCountRDPContract(); SRSPrintDestinationSettings     settings;   // Define report and report design to use controller.parmReportName(ssrsReportStr(SysUserLicenseCountReport, Report)); // Use execution mode appropriate to your situation controller.parmExecutionMode(SysOperationExecutionMode::ScheduledBatch); // Suppress report dialog controller.parmShowDialog(false);   // Explicitly provide all required parameters rdpContract.parmReportStateDate(systemDateGet()); controller.parmReportContract().parmRdpContract(rdpContract);   // Change print settings as needed settings = controller.parmReportContract().parmPrintSettings(); settings.printMediumType(SRSPrintMediumType::File); settings.fileFormat(SRSReportFileFormat::Excel); settings.fileName(@'\\share\UserLicenseCount.xlsx');   // Execute the report controller.startOperation();

Viewing all articles
Browse latest Browse all 130240


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>