The enable externalimages property has not been set for this report?
Asked Answered
J

6

9

I am trying to add an external photo as the logo along with the report on the report.rdlc file. I have this error

The enable externalimages property has not been set for this report

enter image description here?

Here is my code.

 try
{
    this.pedidosTableAdapter.Connection.ConnectionString = con.MysqlConnect();

    this.pedidosTableAdapter.Fill(this.fabricacaoDataSet8.pedidos, Pages.relatorios.num);
    this.reportViewer1.RefreshReport();
}
catch { }

// for external image
this.reportViewer1.LocalReport.EnableExternalImages = true;
ReportParameter parm = new ReportParameter();
parm=(new ReportParameter("path", @"C:\logo.jpg",true));
this.reportViewer1.LocalReport.SetParameters(parm);
this.reportViewer1.Refresh();
Jed answered 22/11, 2012 at 11:23 Comment(2)
The code you posted swallows any exceptions without any notification, which could be part of the issue.Contusion
possible duplicate of External images in .rdlc data reports for winformsSesquipedalian
A
7

I have experience when you enable external images using Code, it works on local / development environment but while deployment on server it does not works and reports raise error:

"The enable external images property has not been set for this report"

In order to solve this issue, use EnableExternalImages="true" property in ASPX or design file where you are using ReportViewer Control and it will work perfectly.

Angelenaangeleno answered 26/7, 2014 at 10:4 Comment(0)
E
6

The problem here actually is, that you're calling this.reportViewer1.RefreshReport(); before setting this.reportViewer1.LocalReport.EnableExternalImages = true;.

The order is important here.

Expeller answered 18/6, 2017 at 14:7 Comment(0)
G
2

I hope this image is a help in your Windows Application.Activate your Reportviewer->Properties->LocalReport->EnableExternalImage and set it to Trueenter image description here

Geanticlinal answered 19/11, 2018 at 15:4 Comment(0)
C
1

As mentioned here, the path of the image must be in URL format, i.e. @"file:///C:\logo.jpg"

Or you can try

var filepath = new Uri("C:\logo.jpg");
var path = new ReportParameter("Path", filepath.AbsolutePath);
this.reportViewer1.LocalReport.SetParameters(new ReportParameter {Path = path});
Copulation answered 20/3, 2014 at 20:2 Comment(0)
L
1

Nothing worked for me, But simply this worked

        LocalReport localReport = new LocalReport();
        localReport.ReportPath = HostingEnvironment.MapPath("~/Reports/myreport.rdlc");
        localReport.EnableExternalImages = true;
        localReport.EnableHyperlinks = true;
Lamartine answered 19/5, 2020 at 20:56 Comment(0)
M
0

For WinForm Applications, below code will works well.

string templateImage = Application_Path + @"\Images\ReportLogo.jpg";
rvRptContainer.LocalReport.EnableExternalImages = true;
rvRptContainer.LocalReport.SetParameters(new ReportParameter("ReportLogo", "File:\\" + templateImage));

For ASP.Net Applications, Do the following:

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();
Mellott answered 16/12, 2018 at 19:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.