none
关于ReportViewer添加印章图片问题

    问题

  • 为了让动态呈现Web报表,我使用了asp.net的 <rsweb:ReportViewer></rsweb:ReportViewer>来加载RDLC报表

    在RDLC中我设置了某个矩形控件(rectangle)的背景图片为外部网络图片url

    但是在客户端浏览器呈现报表的时候有时候会加载不了该图片,检查html元素发现这种情况下对应html的background-image样式丢失

    比如生成这样2种html:

    正常的没有丢失的情况:<table class="A4f66f0847ec74d6880d968a5997fed65224" style='width: 189.18mm; height: 63.39mm; min-width: 189.18mm; background-image: url("/Reserved.ReportViewerWebControl.axd?Culture=2052&amp;CultureOverrides=True&amp;UICulture=2052&amp;UICultureOverrides=True&amp;ReportStack=1&amp;ControlID=48a5ac165aa4431ea4ffaedd8415122a&amp;Mode=true&amp;OpType=ReportImage&amp;IterationId=a05dcaf3363245cc96d9a8efdce0c957&amp;StreamID=9d7223d6c21340cd85aef0c2394b0c21");' border="0" cellspacing="0" cellpadding="0">

    丢失情况:<table class="Ae79ccea62f0e453f932354bc2dbc267b224" style="width: 189.18mm; height: 63.39mm; min-width: 189.18mm;" border="0" cellspacing="0" cellpadding="0">


    我的疑问有2点:

    1为什么使用了外部图片,报表组件依然会把该资源转换为一个Reserved.ReportViewerWebControl.axd后缀的图片资源?

    2如何避免图片加载失败?

    2016年7月4日 9:43

全部回复

  • 参考下这几步

    http://www.c-sharpcorner.com/uploadfile/abylex/show-images-in-reports-at-run-time-using-reportviewer/

    If you do not have images in your Application. That is, you want to use an external image.

    a. Use an Image control on your RDLC file.
    b. Set the
    Image's Property-Source = External.
    c. Reserve a Report's DataSource Member for the image Path. For example- DataSource.ImgPath.
    d. Set the value for image path from the code in
    DataSource.ImgPath.
        For example: DataSource.ImgPath = "http://www.google.com/intl/en_ALL/images/logo.gif";
    e. The following self explanatory code also needs to be written:
        reportViewer1.LocalReport.EnableExternalImages = true;  (reportViewer1 is the Name for the   ReportViewer Control)
    f. Do the normal stuff to bind DataSource etc.
    g. Done. Enjoy your image in the Report.


    专注于.NET ERP/CRM开发框架,C/S架构,SQL Server + ORM(LLBL Gen Pro) + Infragistics WinForms

    2016年7月4日 11:52