[英]insert dynamic images in a crystal reports page from the image folder
有没有办法从图像文件夹中在Crystal Reports页面中动态插入图像?
确切的要求是在每个水晶报告页面的顶部显示公司徽标,当它们发生变化时,即当您有新徽标时,您只需更改图像文件夹中的图像(.jpg)和相应的图像。报告应该改变。
我如何在C#中实现这一目标?
我发布了我得到的答案,希望这对其他人有帮助。
private void getImage()
{
FileStream fs;
fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + "img\\cube.png", FileMode.Open);
BinaryReader BinRed = new BinaryReader(fs);
try
{
CreateTable();
DataRow dr = this.DsImages.Tables["images"].NewRow();
dr["image"] = BinRed.ReadBytes((int)BinRed.BaseStream.Length);
this.DsImages.Tables["images"].Rows.Add(dr);
//FilStr.Close();
BinRed.Close();
DynamicImageExample DyImg = new DynamicImageExample();
DyImg.SetDataSource(this.DsImages);
this.crystalReportViewer1.ReportSource = DyImg;
}
catch (Exception er)
{
MessageBox.Show(er.Message, "Error");
}
}
在CR中,您可以通过以下方式执行此操作:在报表中以您想要的位置和大小插入占位符图像。 右键单击它并选择“格式化图形” - >转到“图片”选项卡 - >在“图形位置”中输入将返回所需文件路径的公式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.