Print Search Rate
    
   07-02-2007, 5:56 AM
HOWTO: Display image from a database in my report if it is stored as an OLE object
The DD Reports Image control cannot automatically display OLE picture objects, but these objects can be converted into a usable format by cutting off the OLE object header via custom code. Here is an example of such code:

    

Public Function ImageStrip(ByVal Picture As Byte()) as Byte()
        Dim strippedImageLength As Integer = Picture.Length - 78
        Dim strippedImageData(strippedImageLength) As Byte
        Array.Copy(Picture,78, strippedImageData, 0, strippedImageLength)
        Return strippedImageData
    End Function


Note: The length of the OLE header depends on the mimetype used to create it. In our example we converted the OLE object, based on the bitmap image to an actual Bitmap format (Ole header length in this case will be 78 bytes)
To use this example you should set the value property of the image control (Value of the BackgroundImage for other controls)
to "=Code.ImageStrip(Fields!Picture.Value)" and the source property to "Database" (assuming your pictures are stored in a
Picture field in the database)


GrapeCity » Knowledge Base » KnowledgeBase f... » HOWTO: Display image from a database in my report if it is stored as an OLE object
Privacy Policy | Copyright © 1997-2012 — GrapeCity, inc.
All trademarks mentioned are the property of their respective owners.