在晶体报告中运行时添加动态图像 [英] add a dynamic image during runtime in crystal report

查看:77
本文介绍了在晶体报告中运行时添加动态图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一些关于计算的图表,我需要在报告部分的水晶报告中显示图形的图像。怎么做。

我写的代码如下:

i get certain graphs on calculation and i need to display the images of graph in the crystal report in the report section. how to do that.
the following code i have written :

/// <summary>
      /// To load the Image stored in the given filepath
      /// </summary>
      /// <param name="filePath"></param>
       private void LoadImage(string filePath)
       {
           //1) create an instance of type dataTable and store the images in it.
           DataTable imageTable = resultDataSet.Tables["GraphsImages"];
           // 2) insert the desired number of rows in the table that holds the images.
           DataRow newRow = imageTable.NewRow();
           // 3) get the image file into a stream reader.
           FileStream fs = new FileStream(filePath, System.IO.FileMode.Open, System.IO.FileAccess.Read);
           byte[] Image = new byte[fs.Length];
           fs.Read(Image, 0, Convert.ToInt32(fs.Length));
           fs.Close();

           newRow[0] = filePath;
           newRow[1] = Image;
           imageTable.Rows.Add(imageTable);

       }



和另一种方法我称之为loadimage函数:


and in the other method i call the loadimage function:

/// <summary>
        /// Handles the Click event of the btnGenerateReport control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void btnGenerateReport_Click(object sender, RoutedEventArgs e)
        {
            string filePath = @"c:\temp\interaction.bmp";
            InteractionChart.SaveBitmap(filePath);
            //VolumeChart.SaveBitmap(@"c:\temp\volumechart.bmp");
            //NetTorqueChart.SaveBitmap(@"c:\temp\netTorqueChart.bmp");
            //NetWOBChart.SaveBitmap(@"c:\temp\netWOBChart.bmp");
            //AreaChart.SaveBitmap(@"c:\temp\areaChart.bmp");
            //DPCChart.SaveBitmap(@"c:\temp\DPCChart.bmp");
            //ForceChart.SaveBitmap(@"c:\temp\forcechart.bmp");
            //WearRateChart.SaveBitmap(@"c:\temp\wearRateChart.bmp");
            LoadImage(filePath);
            ReportGenerated(this);
        }





但是我没有得到图片。我怎么会得到它?非常紧急。



but i am not getting the image. how will i get it? very urgent.

推荐答案

一个可能的解决方案可能是您尝试通过URI在报表中加载图像,然后您可以将URI作为参数传递给报表。



从未尝试过,但这就是我(尝试)做到的。
A possible solution could be that you try to load the image in the report itself via URI and then you could pass the URI as parameter to the report.

Never tried it though, but that''s how I would (try to) do it.


这篇关于在晶体报告中运行时添加动态图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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