2015-12-08 26 views
0

所有:如何jqPlot图像发送到微软的ReportViewer RDLC以生成PDF

这里是我的Web应用程序开发环境的信息:

- 微软的Visual Studio专业2013

-.NET Framework 4.0中

我已经安装了以下内容:

-Microsoft报表查看器2012运行时

-Microsoft报表查看器2010 SP1的WebForms

-jqPlot图表版本:1.0.8版本:1250

为此,我们在工作中开发的应用程序,我们能够生成图形使用jqPlot。

jqPlot将地方在以下DIV部分生成一个ASPX页面中的图形:

<div id="chartdiv" ></div> 

然而,该项目的要求之一是确保图形也可以放置在PDF文件,如果用户想要使用Microsoft ASP.NET报告定义语言客户端(rdlc)和Microsoft ReportViewer技术生成pdf。

1)是否可以直接将jqPlot图形作为图像转换为pdf文件?

如果不是,我已经想出了如何利用jqPlot的API在同一个ASPX页面的另一个div部分创建一个图像。

我只是想简要介绍一下代码:

<div id="chartdiv" ></div> 


    var imgelem = $('#chartdiv').jqplotToImageElem(); 

2)是否有可能发送imgelem变量,它的图像引用到Microsoft的ReportViewer RDLC文件?如果是的话,是否有人可以给我一个高层次的分步计划,告诉我应该如何去实现这样一个功能?

回答

1

看看这篇文章:

http://www.aspsnippets.com/Articles/Dynamically-add-and-display-external-Image-in-RDLC-Report-from-code-behind-in-ASPNet.aspx

有可能通过它reportParameter传递给你的报表查看器注入的图像:

ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc"); 
    ReportViewer1.LocalReport.EnableExternalImages = true; 
    string imagePath = new Uri(Server.MapPath("~/images/Mudassar.jpg")).AbsoluteUri; 
    ReportParameter parameter = new ReportParameter("ImagePath", imagePath); 
    ReportViewer1.LocalReport.SetParameters(parameter); 
    ReportViewer1.LocalReport.Refresh();