从Crystal Reports.Net 9升级到Crystal Reports XI Developer Edition [英] Upgrade from Crystal Reports.Net 9 to Crystal Reports XI Developer Edition

查看:74
本文介绍了从Crystal Reports.Net 9升级到Crystal Reports XI Developer Edition的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从Crystal Reports.Net 9升级到Crystal Reports XI Developer Edition,流式报告功能开始产生错误。 Visual Studio.net 2003确实升级了Crystal Reports报表查看器控件,但流功能不再起作用。什么后端升级是必要的?
下面是生成错误后面的代码。



---------- - [Stream Export Option [1]] -------
'Dim myExportFile2 As String = Server.MapPath(" Reports / output /")& Session.SessionID& < .pdf"
myExportFile = Server.MapPath(" Reports / output /")& Session.SessionID& " .pdf"


myDiskFileDestintionOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
myDiskFileDestintionOptions.DiskFileName = myExportFile
'myExportOptions = Report。 ExportOptions



Dim s As System.IO.MemoryStream = Report.ExportToStream(ExportFormatType.PortableDocFormat)


''下面的代码将在内存中创建pdfs
''并将它们流式传输到浏览器中,而不是在磁盘上创建文件。
HttpContext.Current.Response
'。。Clear()
.ClearContent()
.ClearHeaders()'
.ContentType =" application / pdf"
.AddHeader(" Content- Disposition"," inline; filename = Report.pdf")
.BinaryWrite(s.ToArray)
.End()
End with
'------- ---- [/ Stream Export Option [1]] -------



---------------- [生成错误] ----------------------- < br>缺少参数值。
描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。


异常详细信息:System.Runtime.InteropServices.COMException:缺少参数值。


源错误:



848行:
第849行:'Dim s As System.IO .MemoryStream = Report.ExportToStream(ExportFormatType.PortableDocFormat)
第850行:Dim s As System.IO.MemoryStream = Report.ExportToStream(ExportFormatType.PortableDocFormat)
---------- ------ [/生成错误] -----------------------

解决方案

您需要为XI安装晶体运行时(合并模块),我还建议您将代码切换为:


System.IO.Stream oStream;
byte [] byteArray = null;
oStream = crReportDocument.ExportToStream(ExportFormatType.PortableDocFormat);
byteArray = new byte [oStream.Length];
oStream.Read(byteArray,0,Convert.ToInt32( oStream.Length-1));
Response.ClearContent();
Response.ClearHeaders();
Respo nse.ContentType =" application / pdf" ;;
Response.BinaryWrite(byteArray) ;
Response.Flush() ;
Response.Close() ;


不是很多变化,但这是我被告知从Crystal获得支持的方式。


Upgraded from Crystal Reports.Net 9 to Crystal Reports XI Developer Edition and the streaming report functionality started generating errors. The Visual Studio.net 2003 did  upgrade the Crystal Reports report viewer control but the streaming functionality ceased to work.  What backend upgrades are necessary?
Below is the code followed by the error generated.


-----------[ Stream Export Option [1] ]-------
'Dim myExportFile2 As String = Server.MapPath("Reports/output/") & Session.SessionID & ".pdf"
myExportFile = Server.MapPath("Reports/output/") & Session.SessionID & ".pdf"

myDiskFileDestintionOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions
myDiskFileDestintionOptions.DiskFileName = myExportFile
'myExportOptions = Report.ExportOptions


Dim s As System.IO.MemoryStream = Report.ExportToStream(ExportFormatType.PortableDocFormat)

'' the code below will create pdfs
'' in memory and stream them to the browser
'' instead of creating files on disk.
With HttpContext.Current.Response
    '.Clear()
    .ClearContent()
    .ClearHeaders() '
    .ContentType = "application/pdf"
    .AddHeader("Content-Disposition", "inline; filename=Report.pdf")
    .BinaryWrite(s.ToArray)
    .End()
End With
'-----------[/ Stream Export Option [1] ]-------

 

----------------[ Error Generated ]-----------------------
Missing parameter values.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Missing parameter values.

Source Error:


Line 848:
Line 849:                'Dim s As System.IO.MemoryStream = Report.ExportToStream(ExportFormatType.PortableDocFormat)
Line 850:                Dim s As System.IO.MemoryStream = Report.ExportToStream(ExportFormatType.PortableDocFormat)
----------------[/ Error Generated ]-----------------------
 

解决方案

You need to install the crystal runtimes for XI (merge modules), I would also suggest switching your code to:

  System.IO.Stream oStream;                
 
byte[] byteArray = null;
  oStream = crReportDocument.ExportToStream(ExportFormatType.PortableDocFormat);
  byteArray = new byte[oStream.Length];
 
oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length-1));
 
Response.ClearContent();
  Response.ClearHeaders();
  Response.ContentType = "application/pdf";             
  Response.BinaryWrite(byteArray);
  Response.Flush();
  Response.Close();

Not a whole lot of change, but this is what I've been told is the supported way to do it from Crystal. 


这篇关于从Crystal Reports.Net 9升级到Crystal Reports XI Developer Edition的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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