将报表打印到文件

 1 static void Jinn_printter(Args _args)
 2 {
 3     Args             m_args = new Args();
 4     SysReportRun     m_reportRun;
 5     printJobSettings m_printJobSettings = new printJobSettings();
 6     
 7     boolean          isCorrect = true;
 8     ;
 9     try
10     {
11         if (winAPI::fileExists("c:\\wo_mstr.pdf"))
12         {
13             winAPI::deleteFile("c:\\wo_mstr.pdf");
14         }
15         
16         m_printJobSettings.setTarget(PrintMedium::File);
17         //printJobSettings.preferredTarget(PrintMedium::File);
18         m_printJobSettings.format(PrintFormat::PDF);
19         //printJobSettings.preferredFileFormat(PrintFormat::PDF);
20         m_printJobSettings.fileName("c:\\wo_mstr.pdf");
21 
22         m_args.name(reportstr(wo_mstr));
23         m_reportRun = classfactory.reportRunClass(m_args);
24         m_reportRun.query().interactive(false);
25         m_reportRun.report().interactive(false);
26 
27         m_reportRun.printJobSettings(m_printJobSettings.packPrintJobSettings());
28 
29         m_reportRun.run();
30     }
31     catch (exception::Error)
32     {
33         isCorrect = false;
34     }
35     
36     if (!isCorrect)
37     {
38         info("some errors have been occured");
39     }
40 }
posted @ 2012-08-30 15:56  Sprite.z  Views(199)  Comments(0Edit  收藏  举报