470,641 Members | 1,578 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,641 developers. It's quick & easy.

Crystal Reports Does Not Display BLOB Field Correctly in IBlobField Control Using Crystal Reports for VS.NET 2003


The bitmap I am trying to display in a sample Crystal Report is coming
up with much less quality than the original bitmap.

I have a 300x300 dpi bitmap file that I want to insert at run time into
a Crystal Report. The path to the file is stored in a varchar(100)
field in a table in SQL Server.

The Crystal Report displays the bitmap in the IBlobField object but it
is distorted and its resolution is much less than 300x300 dpi.

I created an .xsd file to represent a strongly typed dataset that was
used in order to design the Crystal Report. The column used to
populate the bitmap is of datatype "base64binary". It is also relevant
to note that the size of the IBlobField column that will be used to
display the bitmap has the same size dimension (3 inches wide x 1 inch
height) as the original bitmap.

The following C# code uses the path to the bitmap file, reads it into a
byte array, and then creates a DataTable that will be the source for
the Crystal Report. The properties of the Crystal Report Viewer
control are set in order to display the report.

Here is the code:

private void Form1_Load(object sender, System.EventArgs e)
// read bitmap file into Byte Array
String sPhotoFileName;
byte[] PhotoData;
sPhotoFileName = ConfigurationSettings.AppSettings["PhotoFilePath"] +

if (File.Exists(sPhotoFileName) == true)
FileStream fs = new
FileStream(sPhotoFileName,FileMode.Open,FileAccess .Read);

BinaryReader r = new BinaryReader(fs);
PhotoData = r.ReadBytes((int)fs.Length);

PhotoData = null;

// create DataTable
DataTable dtEmployees = new DataTable();

dtEmployees.Columns.Add("LastName",typeof(string)) ;
dtEmployees.Columns.Add("FirstName",typeof(string) );

DataRow dr = dtEmployees.NewRow();

dr["EmployeeID"] = 123;
dr["LastName"] = "Schwartzmann";
dr["FirstName"] = "Jeff";

if (PhotoData != null)
dr["Photo"] = PhotoData;
dr["Photo"] = DBNull.Value;


// run Crystal Report
String sCrystalReportFileName;

sCrystalReportFileName =
ConfigurationSettings.AppSettings["CrystalFilePath"] +

ReportDocument oRpt = new ReportDocument();

crViewer.DisplayGroupTree = false;
crViewer.ReportSource = oRpt;

Thanks in advance for your help!!!!

May 4 '06 #1
0 6823

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Stephan | last post: by
13 posts views Thread by kristoff plasun | last post: by
1 post views Thread by Samuel | last post: by
7 posts views Thread by p | last post: by
5 posts views Thread by Damir | last post: by
1 post views Thread by Peter Proost | last post: by
reply views Thread by Chris | last post: by
1 post views Thread by Korara | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.