FastReport for .Net打印图片
FastReport for .Net打印图片Fast Report for .Net 1.x。
用户报表新增打印照片功能,报表预览如下:
void band_BeforePrint(object sender, EventArgs e)
{
//取出当前正在打印的记录(DataRow)。
DataRow row = (sender as DataBand).DataSource.CurrentRow as DataRow;
//处理图片:
byte[] imgData = row["PhotoImg"] as byte[];//图片数据为字节数组
Image img = CImageLibrary.FromBytes(imgData);//将字节转换为图片
PictureObject pic = rptUser.FindObject("Picture1") as PictureObject;
pic.Image = img;
//做其它特殊处理:
int i = (sender as DataBand).DataSource.CurrentRowNo; //取资料行号
(rptUser.FindObject("Text8") as TextObject).Text = "DataRow:" + i.ToString();
}
CImageLibrary库下载: