我目前處於AX 2009 SP1彙總7.我試圖在我的方法運行時將CustQuotationJour表中的報價ID發送到SalesQuotation報表來創建PDF。打印銷售報價至PDF AX 2009
該方法工作正常,但報告發送到打印預覽屏幕而不是創建PDF。我假設它的SalesQuotation報告重置我的打印設置恢復到屏幕。我的猜測是在fetch方法中,但我不應該修改它,對吧?
是否有其他打印設置可能丟失? 在此先感謝
ReportRun salesQuotationReport;
Args args = new Args();
PrintJobSettings printJobSettings;
CustQuotationJour custQuotationJour;
;
custQuotationJour = CustQuotationJour::findFromSalesQuotationQuotation(_quotationId);
args.name(reportStr(SalesQuotation));
args.record(custQuotationJour);
salesQuotationReport = new ReportRun(args);
salesQuotationReport.init();
printJobSettings = salesQuotationReport.printJobSettings();
printJobSettings.setTarget(PrintMedium::File);
printJobSettings.preferredTarget(PrintMedium::File);
printJobSettings.format(PrintFormat::PDF);
printJobSettings.preferredFileFormat(PrintFormat::PDF);
printJobSettings.fileName(_path);
salesQuotationReport.unpackPrintJobSettings(printJobSettings.packPrintJobSettings());
salesQuotationReport.run();
使用谷歌搜索的方法:http://ax4dev.wordpress.com/2010/07/27/writing-a-report-to-file-through-code/ –