将图像插入水晶报表 [英] Insert image to crystal reports

查看:630
本文介绍了将图像插入水晶报表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将图片插入水晶报表
我有ADO.NET数据连接,我使用

Insert image to crystal report I have ADO.NET data connection where i'm using

<xs:element name="Drawing" type="xs:byte" minOccurs="0" />

,所以如何使用图像字节数据在我的水晶报表2013 。
我没有使用任何后端编码,因为可能有很多图像在检索的数据,
这里是我的数据结构的表绘图是数据的字段我存储为字节

for image field, so how can i use that image byte data to display image in my crystal reports 2013. I'm not using any backend coding because there's possible many images in that retrieved data, Here's my data structure of table "Drawing" is image field of data which i have stored as byte

我使用image

推荐答案

我不知道我是否理解你的问题,但让我分享一些可能引导你到有用的东西。我理解你说没有后台代码,但我希望这可能包含一些有用的提示为您的情况。

I am not sure if i understood your question, but let me share something that may lead you to something useful. I understand you said there is no "backending code", but i hope this may contain some useful tip for your case.

当我们使用水晶报表中的图像,类型是XSD中的base64Binary。

When we use an image in Crystal Reports, it's type is base64Binary in the XSD.

在数据集中,它的类型是byte []。

In the dataset, it's type is byte[].

该图像作为数据库中的序列化字符串。类似的东西:

We save the image as a serialized string in the database. Something like that:

FileStream stream = new FileStream(filePath, FileMode.Open);
BinaryReader binreader = new BinaryReader(stream);
byte[] buffer = new byte[(int) stream.Length];
buffer = binreader.ReadBytes((int) stream.Length);
string serialized = Convert.ToBase64String(buffer)

要放入数据集:

byte[] buffer = Convert.FromBase64String(serialized)

在Crystal报表设计工具中,我们只需将字段拖到文档。

In the Crystal Report design tool, we just drag the field to the document.

这篇关于将图像插入水晶报表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆