2013年6月16日星期日
How to using x++ code to printing PDF format [AX2012]
public class THK_MinutesTableController extends SrsReportRunController
{
}
----------------------------------------------------------------------
static void main(Args _args)
{
THK_MinutesTableController controller;
THK_MinutesTableContract contract;
;
controller = new THK_MinutesTableController();
controller.parmReportName("THK_MinutesTable.Design");
controller.parmDialogCaption("@THK422");
controller.parmArgs(_args);
controller.setRange(_args, controller.parmReportContract().parmQueryContracts().lookup(controller.getFirstQueryContractKey()));
contract = controller.parmReportContract().parmRdpContract() as THK_MinutesTableContract;
if (controller.prompt())
{
if (contract.parmExportPDF())
{
controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::File);
controller.parmReportContract().parmPrintSettings().overwriteFile(true);
controller.parmReportContract().parmPrintSettings().fileFormat(SRSReportFileFormat::PDF);
controller.parmReportContract().parmPrintSettings().fileName(controller.getFileNameSave());
controller.run();
}
else
{
controller.parmReportContract().parmPrintSettings().printMediumType(SRSPrintMediumType::Screen);
controller.run();
}
}
}
------------------------
public FilenameSave getFileNameSave()
{
FilenameSave fileNameSave;
str directory;
str filename;
str dateTime2Str2(utcDateTime _dateTime)
{
utcDateTime dateTime;
;
dateTime = DateTimeUtil::applyTimeZoneOffset(_dateTime, DateTimeUtil::getCompanyTimeZone());
return (strFmt("%1%2%3%4%5%6", DateTimeUtil::year(dateTime),
DateTimeUtil::month(dateTime),
DateTimeUtil::day(dateTime),
DateTimeUtil::hour(dateTime),
DateTimeUtil::minute(dateTime),
DateTimeUtil::second(dateTime)));
}
;
directory = EcoResProductParameters::find().THK_TendorReportExportPath;
filename = strFmt("%1_%2.pdf", "TenderMinutes", dateTime2Str2(DateTimeUtil::utcNow()));
return (strFmt("%1\\%2", directory, filename));
}
订阅:
博文评论 (Atom)
没有评论:
发表评论