Add images from list

Posted by: sea.jabbari on 22 January 2020, 2:23 am EST

    • Post Options:
    • Link

    Posted 22 January 2020, 2:23 am EST

    Hi,

    I’m trying to populate a report from list which contains images. First i tried to pass the Bitmap images:

    var files = ImgList.Select(x => new  { Id = x.Id, Img = System.Drawing.Image.FromFile(Path) }).ToList();
    

    but the images were just empty. then i tried to set the field for every record:

    Img = (ImageField)(report.Fields["Field6"]);
    Img.Picture = System.Drawing.Image.FromFile(path);
    

    here the last image keeps repeating for every record.

    Can you show me how it’s done?

    Thanks

  • Posted 22 January 2020, 10:04 pm EST

    Hello,

    Image fields should have byte type as Bitmap type is not supported yet. Convert your Bitmap type images to a byte array and then use it for a report’s ImageField.

    Img.Picture = System.Drawing.Image.FromFile(path);

    Note that the above code sets the last image to the ImageField because it is not added as an expression from a database. You would need to first bind the report to the list using the Recordset property and then set the Picture property of the ImageField as an expression of property containing the image.

    Refer the attached application for the implementation.

    Regards,

    Esha

    C1FlexReport_ImageFromList.zip

  • Posted 25 January 2020, 9:55 pm EST

    Thank you so much for the fast reply.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels