␡
- Overview of BIRT scripting
- Understanding the event handler execution sequence
- About a report item event handler
- About data source and data set event handlers
- About ReportDesign event handlers
- Writing event handlers for charts
- Getting a dynamic image from a Microsoft Access database
< Back
Page 7 of 7
This chapter is from the book
Getting a dynamic image from a Microsoft Access database
Microsoft Access stores an image as an array of image bytes preceded by 78 bytes of header information. BIRT does not use the header information. To get a dynamic image from an Access database, you must copy the image data from the database field into a Java array of type byte. You perform this copy operation in the dynamic image expression.
The following script is an example of how to copy the image data from the Access image field into a byte array that BIRT can use:
var picBytes = row["Picture"]; var offset = 78; var lengthOfImage = picBytes.length - offset; var imgBytes = java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, lengthOfImage); java.lang.System.arraycopy(picBytes, offset, imgBytes, 0, lengthOfImage); imgBytes;
< Back
Page 7 of 7