当前位置: 代码迷 >> ASP.NET >> C# 打印输出的 异常 求大牛们解决!
  详细解决方案

C# 打印输出的 异常 求大牛们解决!

热度:11641   发布时间:2013-02-25 00:00:00.0
C# 打印输出的 错误 求大牛们解决!!!!
这是一个打印输出的 主要操作 函数 我不理解 new SvfrClient(strHost) 实例化的这个函数
还有他随后的 .VrInit() 等一系列方法 原理到底是什么 有用过这个方法打印输出账单的 解决下 谢谢啦!!!
protected void Output_Report(string strSpoolFile)
{

int code = 0;

try
{

svf = new SvfrClient(strHost);


code = svf.VrInit();
if ( code < 0 )
{
StringBuilder StbLogMsg = new StringBuilder();
StbLogMsg.Append(Util.GetLogMessage(httSession,"\r\nErrorMessage : "));
StbLogMsg.Append("\r\nErrorMethod : Output_Report");
log.Error(StbLogMsg.ToString());


string strMessage = Util.GetMessage(messageManager, strWorkName, 
MessageId_Report.EREP0001);
throw new ReportException(strMessage);
}


code = svf.VrSetPrinter("EMF","EMF");
if ( code < 0 )
{

StringBuilder StbLogMsg = new StringBuilder();
StbLogMsg.Append(Util.GetLogMessage(httSession,"\r\nErrorMessage :"));
StbLogMsg.Append("\r\nErrorMethod : Output_Report");
log.Error(StbLogMsg.ToString());


string strMessage = Util.GetMessage(messageManager, strWorkName,
MessageId_Report.EREP0002);
throw new ReportException(strMessage);
}


code = svf.VrSetSpoolFileName2(strPdfPath + strSpoolFile + ".wdp");
if (code < 0)
{

StringBuilder StbLogMsg = new StringBuilder();
StbLogMsg.Append(Util.GetLogMessage(httSession,
"\r\nErrorMessage : "));
StbLogMsg.Append("\r\nErrorMethod : Output_Report");
log.Error(StbLogMsg.ToString());


string strMessage = Util.GetMessage(messageManager,strWorkName, 
MessageId_Report.EREP0003);
throw new ReportException(strMessage);
}


code = svf.VrComout("/{SPLM 3}/");
if (code < 0)
{

StringBuilder StbLogMsg = new StringBuilder();
StbLogMsg.Append(Util.GetLogMessage(httSession,
"\r\nErrorMessage : "));
StbLogMsg.Append("\r\nErrorMethod : Output_Report");
log.Error(StbLogMsg.ToString());


string strMessage = Util.GetMessage(messageManager, strWorkName, 
MessageId_Report.EREP0004);
throw new ReportException(strMessage);
}


PrintFormData();


code = svf.VrPrint();
if (code < 0) 
{

StringBuilder StbLogMsg = new StringBuilder();
StbLogMsg.Append(Util.GetLogMessage(httSession,"\r\nErrorMessage : "));
StbLogMsg.Append("\r\nErrorMethod : Output_Report");
log.Error(StbLogMsg.ToString());


string strMessage = Util.GetMessage(messageManager, strWorkName, 
MessageId_Report.EREP0005);
throw new ReportException(strMessage);
}


code = svf.VrQuit();//出错的地方,直接抛异常!!
if (code < 0) 
{

StringBuilder StbLogMsg = new StringBuilder();
StbLogMsg.Append(Util.GetLogMessage(httSession,
"\r\nErrorMessage : "));
StbLogMsg.Append("\r\nErrorMethod : Output_Report");
log.Error(StbLogMsg.ToString());


string strMessage = Util.GetMessage(messageManager, strWorkName, 
MessageId_Report.EREP0006);
throw new ReportException(strMessage);
}
}
catch(DException)
{
throw;
}
catch(Exception ex)
{

StringBuilder StbLogMsg = new StringBuilder();