pkpmgl 发表于 2021-1-8 09:36:48

照片显示问题


如图,两张保存到服务器目录,数据库保存图片名称,该怎么把多个图片显示出来

KearneyKang 发表于 2021-1-8 09:36:49


Web端设计器的图片使用:

web端的URL好像有一点问题,产品本身问题,已经提了case

KearneyKang 发表于 2021-1-8 09:41:13

你好,你现在是图片控件显示不出来图片是这样吗?你可以看看这个教程:https://help.grapecity.com.cn/pages/viewpage.action?pageId=47645464

KearneyKang 发表于 2021-1-8 11:25:31

namespace JSviewerDatasource
{
    public class Startup1
    {
      public static string EmbeddedReportsPrefix = "JSdatasource";
      string ReportName = "";
      public object GetReport(string P)//获取报表名称和报表参数,进行一个对应的报表名称和参数的分割
      {
            string reportName = P.Split(';');//报表名称;
             string parameter1 = P.Split(';');//参数1;
            string parameter2 = P.Split(';');//参数2;
            PageReport rep = new PageReport();

            string path = System.Web.Hosting.HostingEnvironment.MapPath("~/");
            rep.Load(new FileInfo(@"" + path + "Reports/" + reportName));
            //rep.Report.ReportParameters.DefaultValue.Values.Add("111");
            return rep.Report;            
      }

      public void Configuration(IAppBuilder app)
      {
      
            app.UseReporting(settings =>
            {
                settings.UseCompression = true;
                settings.UseCustomStore(GetReport);//使用UseCustomStore来自定义一些需要的值
                                                   //settings.UseFileStore(new DirectoryInfo(String.Format(@"{0}.\Reports\", HttpRuntime.AppDomainAppPath)));               
                settings.LocateDataSource = args =>
                {
                  DataTable dt = new DataTable();
                  string name = ReportName;
                  if (args.DataSet.Query.DataSourceName == "DataSource1")
                  {                     
                        if (args.DataSet.Name == "DataSet2")
                        {
                            string fp = "D://照片//报表水印.png";
                            //byte[] a = File.ReadAllBytes(@"D:\照片\报表水印.png");
                           
                            byte[] a = SaveImage(fp);
                            MemoryStream stream = new MemoryStream(a);

                            BitmapImage bmp = new BitmapImage();

                            bmp.BeginInit();//初始化

                            bmp.StreamSource = stream;//设置源

                            bmp.EndInit();//初始化结束

                            dt.Columns.Add("产品编号");
                            dt.Columns.Add("产品名称");
                            dt.Columns.Add("单价");
                            dt.Columns.Add("库存量");
                            dt.Columns.Add("产地");
                            dt.Columns.Add("图片", typeof(byte[]));//二进制流的形式,默认不设置是字符串类型,绑定不同数据类型的值,需要进行对应的属性设置。
                            dt.Rows.Add("A001", "苹果", 10, 300, "中国", a);                           
                        }
                  }
                  return dt;
                };


            });

      }
      public byte[] SaveImage(String path)
      {
            string aa = string.Empty;
            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read);

            //将图片以文件流的形式进行保存
            BinaryReader br = new BinaryReader(fs);
            byte[] imgBytesIn = br.ReadBytes((int)fs.Length);//将流读入到字节数组中
            return imgBytesIn;

      }

    }
}

pkpmgl 发表于 2021-1-8 11:37:33


这个value在web版本的设计器什么地方,从哪里可以设置
页: [1]
查看完整版本: 照片显示问题