Tuesday, 15 October 2013

Job to save the SSRS in PDF at given location in Dynamic AX


static void SaveSSRSasPdfCode(Args _args)
{
     SrsReportRun srsReportRun;

    srsReportRun = new SrsReportRun("ReportName.PrecisionDesign1");

    srsReportRun.init();
    srsReportRun.reportCaption("ReportName.PrecisionDesign1");
    //Parameter to be passed
    srsReportRun.reportParameter("TableNameused").value("Parameter");
    srsReportRun.showDialog(false);

    // Print to a file as ur name and location in HTML/PDF format.
    srsReportRun.printDestinationSettings().printMediumType(SRSPrintMediumType::File);
    srsReportRun.printDestinationSettings().fileFormat(SRSReportFileFormat::PDF);
    srsReportRun.printDestinationSettings().overwriteFile(true);
    srsReportRun.printDestinationSettings().fileName(@"C:\UrReportName.pdf");

    if( srsReportRun )
    {
        srsReportRun.executeReport();
    }
}

No comments:

Post a Comment