|
19.07.2012, 18:11 | #1 |
Участник
|
ax-erp: Save SSRS report to pdf that uses Controller classes [Dynamics AX 2012]
Источник: http://microsoft-dynamics-ax-erp.blo...that-uses.html
============== Friends, This is the most commonly asked requirement of saving the report to pdf and send it to through email. We all know that SRSReportRun class is helpful in combination with printDestinationsettings to save to pdf file. But tricky requirements are those which uses controller classes for the report. Below is the small snippet which will help to save the sales invoice report to pdf that actually uses controller classes. staticvoid SR_SaveReportToPDFFromController(Args _args) { SalesInvoiceController salesInvoiceController; SalesInvoiceContract salesInvoiceContract; Args args = new Args(); SrsReportRunImpl srsReportRun; CustInvoiceJour custInvoiceJour; ReportName reportName = "SalesInvoice.Report"; ; selectfirstOnly custInvoiceJour; args.record(custInvoiceJour); salesInvoiceController = new SalesInvoiceController(); salesInvoiceController.parmReportName(reportName); salesInvoiceContract = salesInvoiceController.parmReportContract().parmRdpContract(); salesInvoiceContract.parmRecordId(custInvoiceJour.RecId); // Record id must be passed otherwise the report will be empty salesInvoiceContract.parmCountryRegionISOCode(SysCountryRegionCode::countryInfo()); // comment this code if tested in pre release salesInvoiceController.parmArgs(args); srsReportRun = salesInvoiceController.parmReportRun() as SrsReportRunImpl; salesInvoiceController.parmReportRun(srsReportRun); salesInvoiceController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File); salesInvoiceController.parmReportContract().parmPrintSettings().overwriteFile(true); salesInvoiceController.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF); salesInvoiceController.parmReportContract().parmPrintSettings().fileName(‘c:\\SR_SalesInvoice.pdf’); salesInvoiceController.runReport(); } Below is the pdf file output: Источник: http://microsoft-dynamics-ax-erp.blo...that-uses.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|