Multicolumn Pictures in Crystal Reports

Hello guys, its been a while since a posted something on this blog. I was working on this project where an item can have as many pictures as possible, as part of the requirement , a report was to be generated to show the item information and its pictures ( in a multicolumn way).

Below are the steps to show pictures in crystal reports (Note that the the data type used is image and hence using datasets as the data source for the reports, the picture can easily be dragged onto the report)

1. To start, the picture is dragged to the detail section of the report as shown in the picture below


2. Then right click on the “detail section” tab and choose the “section expert” as shown in the picture below


3. In the dialog box that appear, make sure the “details” section is selected and on the right hand side, on the “common” tab make sure “Format with Multiple columns “ is checked. The move to the “Layout” tab, make the required changes and make sure in the “printing direction” section you select “across” and down.


4. You are now done, with the reports, run you program and something as shown in the picture below should be shown.



If you want to insert images from the file system (eg, C:\images folder) into crystal reports here is a simple process of doing that.

Add a dataset  to your project. Add a datatable to the dataset. Then add a row of data type system.byte().


Add a new crystal report using the dataset created as its datasource. You are done now.

Add a new form to your project with a crystal report viewer and a button

The method below handles the button click event

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim ofd As New OpenFileDialog()

        ofd.Multiselect = False

        ofd.Filter = “Images|*.jpg;*gif;*.bmp”

        If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then



            MessageBox.Show(“Please select a Picture”)

        End If

    End Sub


Public Function savepic(ByVal fsource As String) As Byte()

        Dim arrImage() As Byte = Nothing

        If File.Exists(fsource) = False Then

            Return arrImage

        End If

        Dim img As Image = Image.FromFile(fsource)

        Dim ms As New IO.MemoryStream

        img.Save(ms, img.RawFormat)

        arrImage = ms.GetBuffer


        Return arrImage

    End Function


    Private Sub createReports(ByVal image() As Byte)


        Dim nrow As DataRow = DataSet1.reports.NewreportsRow

        nrow(0) = image


        Dim rpt1 As New rptImages     ‘ crystal report object

        rpt1.SetDataSource(DataSet1)            ‘ set the datasource of crystalreport object, dataset 1 was the one created

        CrystalReportViewer1.ReportSource = rpt1

    End Sub


Sample picture when the application is run

Sample Picture of the Application
Sample Picture of the Application