Crystal report runtime (version 13.0.0.99) is installed on the development machine (Window 10, 64-Bit). The following code displays a log-on report:
string sPath="D:\Image\company_logo.gif"CrystalDecision.CrystalReports.ViewerObjectModel.BlobFileObjectInstance bimg=(CrystalDecisions.CrystalReports.ViewerObjectModel.BlobFieldObjectInstance)if(bimg !=null&&System.IO.File.Exists(sPath)){//Set company_logo.gif on IBlobFieldObject placed of Crystal Report
bimg.bitmap =(System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(sPath);}
Same is working fine on machines where SAP Crystal Report Runtime engine (version 13.0.0.99) installed.
We upgraded the SAP Crystal Report Runtime engine to version 13.0.18.2192, causing this error:
Error 5 'CrystalDecisions.CrystalReports.ViewerObjectModel.BlobFieldObjectInstance' does not contain a definition for 'bitmap' and no extension method 'bitmap' accepting a first argument of type 'CrystalDecision.CrystalReports.ViewerObjectModel.BlobFieldObjectInstance'
could be found (are you missing a using directive or an assembly reference?)
To resolve this we use bitmapStream
instead of bitmap
which works fine post-upgrade:
CrystalDecisions.CrystalReports.ViewerObjectModel.BlogFieldObjectInstance bimg =(CrystalDecisions.CrystalReports.ViewerObjectModel.BlobFieldObjectInstance)if(bimg !=null&&System.IO.File.Exists(sPath)){//Set company_logo.gif on IBlobFieldObject placed of Crystal Report
bimg.bitmapStream =newMemoryStream(ConvertTobyteArray((System.Drawing.Bitmap)System.Drawing.Bitmap.FromFile(sPath)));}publicbyte[]ConvertTobyteArray(Bitmap value){byte[] bitmapbytes =newbyte[5000];MemoryStream stream;
using ( stream =newMemoryStream()){
value.Save(stream, value.RawFormate);
bitmapbytes = stream.ToArray();}
stream.Dispose();return bitmapbytes;}
But the same code on machine with Crystal Report Runtime (version 13.0.0.99) gets this error:
Error 5 'CrystalDecisions.CrystalReports.ViewerObjectModel.BlobFieldObjectInstance' does not contain a definition for 'bitmapstream' and no extension method 'bitmapstream' accepting first argument of type 'CrystalDecisions.CrystalReports.ViewerObjectModel.BlobFieldObjectInstance'
could be found (are you missing a using directive or an assembly reference?)
If the Crystal Report runtime is upgraded to a newer version, why is the bitmap property no longer supported? How can we display an image a report for either version?