Multiple Pictures from Split Loop
Hello!
I am using a report that is connected to a Dataset with a String Field. In that string there is a path for a image file.
I can set the Path and the Image is shown correctly.
Now in that Datafield there are 3 Image-Paths, seperated with an "?". So for example:
C:\image1.png?C:\image2.png?C:\image3.png?
I could now split the single Images in a Loop in the Code of the report. But how can I make it so that all 3 Pictures are displayed in the report? When I take a Picture in the Report Designer it will of course just display 1 Image. But I want to display the amount of splits. I would need to tell it to create a new row/databand per image in the Datafield.
How can I achieve this?
Thanks!
This discussion has been closed.
Comments
Hello!
In the BeforePrint event of your DataBand, split the string by “?” and, for each path, display a ChildBand containing a single PictureObject (or add a PictureObject to the DataBand, clearing the Objects from the previous string):
private void Data1_BeforePrint(object sender, EventArgs e) { string raw = ((string)Report.GetColumnValue(‘Rows.Images’) ?? ‘’); string[] paths = raw.Split(“?”, StringSplitOptions.RemoveEmptyEntries); foreach (string p in paths) { Picture1.LoadImage(p); // or Picture1.ImageLocation = p; Engine.ShowBand(Child1); } }