我需要找到一种方法来打印SrsReport
,在我的情况下,SalesInvoice
,作为.PDF(或任何类型的文件)到一个特定的位置。打印SSRSReport到文件(.PDF)
为此,我修改了SRSPrintDestinationSettings
输出SalesInvoice-报告为.PDF:
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::PDF);
settings.overwriteFile(true);
settings.fileName(@'\\AXDEV\Bottomline\Test\test.pdf');
不知怎的,这个被忽略,我recive附带的报告.PDF一个电子邮件。
例如,这将在ax 2012上运行,但不会为我打印为PDF。
SRSPrintDestinationSettings settings;
CustInvoiceJour custInvoiceJour;
SrsReportRunController controller = new SrsReportRunController();
PurchPurchaseOrderContract rdpContract = new PurchPurchaseOrderContract();
SalesInvoiceContract salesInvoiceContract = new SalesInvoiceContract();
select firstOnly1 * from custInvoiceJour where custInvoiceJour.SalesId != "";
// Define report and report design to use
controller.parmReportName(ssrsReportStr(SalesInvoice,Report));
// Use execution mode appropriate to your situation
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
rdpContract.parmRecordId(custInvoiceJour.RecId);
controller.parmReportContract().parmRdpContract(rdpContract);
// Explicitly provide all required parameters
salesInvoiceContract.parmRecordId(custInvoiceJour.RecId); // Record id must be passed otherwise the report will be empty
controller.parmReportContract().parmRdpContract(salesInvoiceContract);
salesInvoiceContract.parmCountryRegionISOCode(SysCountryRegionCode::countryInfo()); // comment this code if tested in pre release
// Change print settings as needed
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::PDF);
settings.overwriteFile(true);
settings.fileName(@'\\AXDEV\Bottomline\Test\test.pdf');
//tokens = settings as SrsPrintDestinationTokens();
//controller.parmPrintDestinationTokens(null);
//Suppress report dialog
controller.parmShowDialog(false);
// Execute the report
controller.startOperation();
问题: 这是打印srsReport为pdf格式正确的方法是什么? 我是否正确地传递/设置printerSettings? 它说“发送电子邮件”在哪里?
编辑:代码工作正常。我们正在使用一个公司的外部代码,它根本没有实现这一点。 使用Alex Kwitny的清洁代码
代码和我的一样,但是更好:D。代码应该适用于其他人。问题是我的公司使用了名为Bottomline的公司的技术。看起来它不支持PDF输出。我将不得不修改它。感谢您的帮助=) – C0d1ngJammer