How can I load an image saved in database to Visual Studio ReportViewer 2008? -
Do anyone know how I can save the AI image in the database and show it on Report 2008?
Thank you!
I am currently doing this, however, it was not easy to get it.
I created a class that makes RDLC files in memorystream, the RDLC memory stream is sent to Report Weaver Control, which in turn displays the report.
During the generation of the RDLC file, you can create an embedded image. To do this, I retrieve the image in a byte array, then I convert the byte array to base 64 encoding. Base 64 encoding is required to properly display RDLC files.
Again, this was not easy to achieve, so you should really do it to pull it. If you want to move forward with this method, then I can give you some more details.
Edit (more details)
You can get some sample code Dynamically how to create RDLC files Direct link for code.
If you can find out how this code works, then you will be able to generate your RDLC files, and you will not need to manually create the file manually. Again, I need to emphasize this fact that you will be doing a lot of trouble to reach it.
Now, to create images, retrieve it from the database when you withdraw it from the database (I use Blob), you will get a byte array. The byte array holds the data for the image, but I can not be used in its current state. To change this, you can do something like this:
String = "Output = Convert as Dim Output. ToBase64String (imgByteArray) As a result The output string will be consistent with the report report. Now you can dynamically add this string to the ReportViewer's RDLC file (XML file). By using the code examples of GotReportViewer, you can do the following:
< Pre-> 'report includes embedded images overdive f New Rdl.EmbeddedImagesType bgCell.Name = "bgTableHeader" bgCell.Items = New object () {"image / jpeg", output} bgCell as the Ranspace CreateEmbeddedImages () as Rdl.EmbeddedImagesType type BGCL New Rdl.EmbeddedImageType dim images. .emsemsElementName = New Rdl.ItemsChoiceType35 () {Rdl.ItemsChoiceType35.MIMEType, Rdl.ItemsChoiceType35.ImageData} Images. Embedded Image = New Rdl.EmbeddedImageType () {bgCell} Return Images to End Function The RDL type report is a definition language class file, in fact, it is a reverse engineer RDLC XSD schema. This includes classes that will be used to generate a valid XML file for your report. It is included in the top of the GotReportViewer link, but you can create one by using the XSD.EXE tool provided with Visual Studio.