This is a migrated thread and some comments may be shown as answers.

Picture Box Loaded from Web Service Data Source

3 Answers 809 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 2
Eric asked on 09 Jul 2018, 02:03 PM

     I am attempting to use the standalone report designer to populate a report from a Web Service Data Source.  The source will return an image as a byte array (byte[] someImage {get;set;}.  I can see the bytes coming from the web service just fine but when I set the bindings to bind the value to the byte array from the web service the report throws an exception that indicates: "Could not find a part of the path...(encoded byte array here".  I am sending in bytes but the picture box is interpreting the value property as only the path and not the bytes.  Is this possible?  Am I doing this incorrectly?  Do I need to use the Visual Studio designer instead?  Any help or guidance would be appreciated...thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 10 Jul 2018, 02:58 PM
Hello Eric,

If the a data field contains a base64 string you will need to programmatically convert the base64 string to binary image data before assigning it to the PictureBox item. The approach to convert the base64 string to binary image data is to use a user function in the PictureBox.Value expression:

PictureBox.Value = GetImageFromBase64String(Fields.ImageData)

where the GetImageFromBase64String user function definition would be similar to this code snippet:
namespace UserFunctions
{
    public static class ImageHelper
    {
        public static Image GetImageFromBase64String(string base64String)
        {
            byte[] imageBytes = Convert.FromBase64String(base64String);
            Image image;
            using (System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes))
            {
                image = Image.FromStream(ms);
            }
     
            return image;
        }
    }
}

For more information, please refer to the User Functions help article.

Regards,
Nasko
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Eric
Top achievements
Rank 2
answered on 10 Jul 2018, 10:02 PM
Can this be done from the Standalone Report Designer?
0
Nasko
Telerik team
answered on 11 Jul 2018, 07:06 AM
Hello Eric,

Yes, user functions are supported in the Standalone Report Designer by extending its configuration: Extending Report Designer.

Regards,
Nasko
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Report Designer (standalone)
Asked by
Eric
Top achievements
Rank 2
Answers by
Nasko
Telerik team
Eric
Top achievements
Rank 2
Share this question
or