在AX 2012中自动在页面两面打印SSRS报告

时间:2019-05-08 17:48:18

标签: x++ dynamics-ax-2012 dynamics-ax-2012-r3

用户执行操作后,我会自动打印SSRS报告,效果很好。但是,我希望它打印2面。这可能吗?我找不到在线内容,也找不到SRSPrintDestinationSettings类的文档

private static client void runOnClient(ProdId _prodId)
{
    controllerEx  reportRunController;
    DCExmaple   parmData;
    Args            args = new Args();
    //get users default printer from User options
    LM_PrinterName printerName = SysUserInfo::find().lm_PrinterName;

    // Create the report run controller
        reportRunController = new controllerEx();
        reportRunController.parmReportName(ssrsReportStr(CMA_Traveller, CHTravellerReportEnhanced));
        reportRunController.parmLoadFromSysLastValue(false);

        // Set printer settings (you can print to file, format, filename, etc).
        reportRunController.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::Printer);
        reportRunController.parmReportContract().parmPrintSettings().printerName(printerName);

        //More settings to print 2 sided?

        args.record(ProdTable::find(_prodId));
        reportRunController.parmArgs(args);

        parmData = new DCExmaple();
        parmData.parmProdId(_prodId);

        //set the execution mode to Synchronous
        reportRunController.parmExecutionMode(SysOperationExecutionMode::Synchronous);

        reportRunController.parmReportContract().parmRdpContract(parmData);
        // Run the report
        reportRunController.run();
}

1 个答案:

答案 0 :(得分:0)

我不知道您的问题的确切答案,但是我可以告诉您一个很好的方法,使您可以弄清楚它。

创建以下作业并运行它。然后选择打印机双面打印设置以及您想要的东西,然后检查下面列出的两个对象,它应该为您指明正确的方向。

选择所需设置后的另一种选择,将容器c存储在表中作为“双工设置”的位置,然后从上述代码中的容器中加载。

请确保选中Override default settings框,否则您可能将无法进行任何配置。

static void JobPrinterSettings(Args _args)
{
    SRSPrintDestinationSettings         settings = new SRSPrintDestinationSettings();
    container                           c;
    XML                                 printerXML;

    if (SrsReportRunUtil::showSettingsDialog(settings))
    {
        // Examine this container
        c = settings.pack();

        // Examine this XML
        printerXML = SRSProxy::getDefaultPrinterPageSettingsForPrinter(settings.printerName());

        breakpoint;
    }

}

enter image description here