Posted 15 November 2017, 11:02 am EST
Hello,
You would need to convert the Base64 data to image using the code. Suppose the name of the image field in your XML data Source is “ItemImage” then you can use the code as follows to convert the image for Picture control as follows:
DataSet imagesData;
int rowCounter;
private void ImageReport_DataInitialize(object sender, System.EventArgs eArgs)
{
// DataSet to hold data
imagesData = new DataSet();
//your image xml data source
imagesData.ReadXml(Application.StartupPath + "\\Images.xml");
// initialize the counter to the first row
rowCounter = 0;
// Add the columsn from the dataset as field
this.Fields.Add("ItemImage");
}
private void ImageReport_FetchData(object sender, DataDynamics.ActiveReports.ActiveReport.FetchEventArgs eArgs)
{
if ( rowCounter == imagesData.Tables[0].Columns.Count)
{
eArgs.EOF = true;
return;
}
else
{
// the image field
string strPhoto = (string)imagesData.Tables[0].Rows[rowCounter]["ItemImage"];
byte[] arPhoto = Convert.FromBase64String(strPhoto);
MemoryStream memStrm = new MemoryStream( arPhoto, 0, arPhoto.Length );
Bitmap bm = new Bitmap(memStrm);
this.Fields["ItemImage"].Value = bm;
// Advance Row counter
eArgs.EOF = false;
rowCounter++;
}
}
I hope it help!
Thanks,
Deepak Sharma