PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average.

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

 
 
Jeff
Guest
Posts: n/a
 
      4th May 2006
Help!!!

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"] +
@"\Photo.BMP";

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);

r.Close();
fs.Close();
}
else
{
PhotoData = null;
}

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

dtEmployees.Columns.Add("EmployeeID",typeof(int));
dtEmployees.Columns.Add("LastName",typeof(string));
dtEmployees.Columns.Add("FirstName",typeof(string));
dtEmployees.Columns.Add("Photo",typeof(byte[]));

DataRow dr = dtEmployees.NewRow();

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

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

dtEmployees.Rows.Add(dr);

// run Crystal Report
String sCrystalReportFileName;

sCrystalReportFileName =
ConfigurationSettings.AppSettings["CrystalFilePath"] +
@"\CrystalReport1.rpt";

ReportDocument oRpt = new ReportDocument();
oRpt.Load(sCrystalReportFileName);
oRpt.SetDataSource(dtEmployees);

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

}


Thanks in advance for your help!!!!

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
crystal reports blob Peter Proost Microsoft VB .NET 1 21st Feb 2005 09:06 AM
Crystal Reports blob problem? Microsoft Dot NET Framework 1 17th Mar 2004 02:48 PM
BLOB Object in Crystal Reports Winston Microsoft ADO .NET 0 27th Dec 2003 01:53 AM
Crystal Reports BLOB Object image error! Winston Microsoft Dot NET 0 18th Dec 2003 07:52 PM
using Crystal Reports to display data in my dataset correctly (display the data I selected instead of all the data in table) JK Microsoft C# .NET 1 6th Sep 2003 10:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:16 PM.