业务对象/ Crystal报表服务器计划到磁盘 [英] Business objects / Crystal reports server schedule to disk

查看:118
本文介绍了业务对象/ Crystal报表服务器计划到磁盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在尝试安排从ASP应用程序报告文件,以便同时将报告打印到打印机。下面的代码会产生与我在CMC中执行此操作时相同的计划报告。只有在CMC应用程序中才有效,当我尝试代码时,报告保持活动状态,并且不会写入文件或将副本打印到打印机。这可能是什么问题?



这是我的代码:



 string query =选择SI_DEST_SCHEDULEOPTIONS,SI_PROGID来自CI_SYSTEMOBJECTS
+其中SI_PARENTID = 29 AND SI_NAME ='CrystalEnterprise.DiskUnmanaged';
InfoObjects fileInfoObjects = infoStore.Query(query);
InfoObject infoObject = fileInfoObjects [1];

DestinationPlugin destinationPlugin =(DestinationPlugin)infoObject;
DiskUnmanaged diskUnmanaged =(DiskUnmanaged)destinationPlugin;

DestinationOptions destinationOptions = diskUnmanaged.ScheduleOptions;
DiskUnmanagedOptions diskUnmanagedOptions = new DiskUnmanagedOptions(destinationOptions);

diskUnmanagedOptions.DestinationFiles.Add(@c:/PrintedReports/test.rpt);

schedulingInfo.Destination.SetFromPlugin(diskUnmanaged);

query =选择SI_ID,SI_NAME FROM CI_INFOOBJECTS+其中SI_ID =+ report.ID.ToString();
InfoObjects infoObjects = infoStore.Query(query);

infoObject = report;

ReportPrinterOptions reportPrinterOptions = report.ReportPrinterOptions;
reportPrinterOptions.Enabled = true;
reportPrinterOptions.AlwaysPrintToPDF = true;
reportPrinterOptions.Copies = 1;

reportPrinterOptions.PrinterName = printerDataTransfer.PrinterName;

infoObjects = report.ParentInfoObjects;
infoStore.Schedule(infoObjects);

解决方案

解决方法如下:



< pre lang =c#> string query = 选择SI_DEST_SCHEDULEOPTIONS,SI_PROGID来自CI_SYSTEMOBJECTS
+ 其中SI_PARENTID = 29 AND SI_NAME ='CrystalEnterprise。 DiskUnmanaged';
InfoObjects destinationInfoObjects = infoStore.Query(query);
InfoObject infoObject = destinationInfoObjects [ 1 ];


DestinationPlugin destinationPlugin =(DestinationPlugin)infoObject;
DiskUnmanaged diskUnmanaged =(DiskUnmanaged)destinationPlugin;

DestinationOptions destinationOptions = diskUnmanaged.ScheduleOptions;
DiskUnmanagedOptions diskUnmanagedOptions = new DiskUnmanagedOptions(destinationOptions);

diskUnmanagedOptions.DestinationFiles.Add(filename);

diskUnmanagedOptions.UserName = SMC_Reportserver_Classes.Properties.Settings.Default.printFileUser;
diskUnmanagedOptions.Password = SMC_Reportserver_Classes.Properties.Settings.Default.printFilePassword;

schedulingInfo.Destination.SetFromPlugin(diskUnmanaged);
InfoObjects infoObjects = report.ParentInfoObjects;
infoStore.Schedule(infoObjects);


Hi all,

I'm trying to schedule a report from an ASP application to file in order to simultaniously print the report to printer. The code below results to the very same scheduled report as when I do this in the CMC. Only in the CMC application this works and when I try the code the report stays "Active" and does not write a file or print a copy to the printer. What could be the problem here?

This is my code:

string query = "Select SI_DEST_SCHEDULEOPTIONS, SI_PROGID From CI_SYSTEMOBJECTS "
    + "Where SI_PARENTID = 29 AND SI_NAME = 'CrystalEnterprise.DiskUnmanaged'";
InfoObjects fileInfoObjects = infoStore.Query(query);
InfoObject infoObject = fileInfoObjects[1];

DestinationPlugin destinationPlugin = (DestinationPlugin)infoObject;
DiskUnmanaged diskUnmanaged = (DiskUnmanaged)destinationPlugin;

DestinationOptions destinationOptions = diskUnmanaged.ScheduleOptions;
DiskUnmanagedOptions diskUnmanagedOptions = new DiskUnmanagedOptions(destinationOptions);

diskUnmanagedOptions.DestinationFiles.Add(@"c:/PrintedReports/test.rpt");

schedulingInfo.Destination.SetFromPlugin(diskUnmanaged);

query = "Select SI_ID, SI_NAME FROM CI_INFOOBJECTS " + "Where SI_ID=" + report.ID.ToString();
InfoObjects infoObjects = infoStore.Query(query);

infoObject = report;

ReportPrinterOptions reportPrinterOptions = report.ReportPrinterOptions;
reportPrinterOptions.Enabled = true;
reportPrinterOptions.AlwaysPrintToPDF = true;
reportPrinterOptions.Copies = 1;

reportPrinterOptions.PrinterName = printerDataTransfer.PrinterName;

infoObjects = report.ParentInfoObjects;
infoStore.Schedule(infoObjects);

解决方案

Solved it like this:

string query = "Select SI_DEST_SCHEDULEOPTIONS, SI_PROGID From CI_SYSTEMOBJECTS "
    + "Where SI_PARENTID = 29 AND SI_NAME = 'CrystalEnterprise.DiskUnmanaged'";
InfoObjects destinationInfoObjects = infoStore.Query(query);
InfoObject infoObject = destinationInfoObjects[1];


DestinationPlugin destinationPlugin = (DestinationPlugin)infoObject;
DiskUnmanaged diskUnmanaged = (DiskUnmanaged)destinationPlugin;

DestinationOptions destinationOptions = diskUnmanaged.ScheduleOptions;
DiskUnmanagedOptions diskUnmanagedOptions = new DiskUnmanagedOptions(destinationOptions);

diskUnmanagedOptions.DestinationFiles.Add(filename);

diskUnmanagedOptions.UserName = SMC_Reportserver_Classes.Properties.Settings.Default.printFileUser;
diskUnmanagedOptions.Password = SMC_Reportserver_Classes.Properties.Settings.Default.printFilePassword;

schedulingInfo.Destination.SetFromPlugin(diskUnmanaged);
InfoObjects infoObjects = report.ParentInfoObjects;
infoStore.Schedule(infoObjects);


这篇关于业务对象/ Crystal报表服务器计划到磁盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆