我試圖強制打開打印對話框,以便所有用戶所要做的就是設置電子郵件地址並按下確定。我找到了關於如何在沒有打印對話框的情況下將報告打印到文件或打印機的多個教程,但這不是我要找的。從代碼
通常通過電子郵件發送報告,用戶顯示報告,單擊工具欄中的打印圖標,然後選擇電子郵件併發送。我想自動刪除前兩個步驟。
這是我迄今爲止做這個嘗試中的一個,但無濟於事。
void emailInvoice()
{
Args args;
ReportRun rr;
Report rb;
PrintJobSettings pjs;
CustInvoiceJour record;
;
select record where record.RecId == 5637175089;
args = new Args("SalesInvoice");
args.record(record);
args.parmEnum(PrintCopyOriginal::OriginalPrint);
// Set report run properties
rr = new ReportRun(args,'');
rr.suppressReportIsEmptyMessage(true);
rr.query().interactive(false);
// set report properties
rb = rr.report();
rb.interactive(true);
// set print job settings
pjs = rr.printJobSettings();
pjs.fileName(strfmt("C:\\Users\\gbonzo\\Desktop\\%1.pdf", record.SalesId));
pjs.fitToPage(true);
// break the report info pages using the height of the current printer's paper
pjs.virtualPageHeight(-1);
// force PDF printing
pjs.format(PrintFormat::PDF);
pjs.setTarget(PrintMedium::Mail);
pjs.viewerType(ReportOutputUserType::PDF);
// lock the print job settings so can't be changed
// X++ code int the report may try to change the destination
// to the screen for example but this does not make
// sense when running a report here
pjs.lockDestinationProperties(true);
// Initialize the report
rr.init();
rr.run();
}
在此先感謝您的幫助!
我有我的疑惑: 1)CustInvoiceJour記錄; 和 2)args = new Args(「SalesInvoice」); – SamekaTV