August 1, 2007 at 1:12 pm
I am having an issue getting images to display in my reports.
We use the web service to render the reports. Whenever I put an image in a report and render it in HTML the image does not display. I only get a red X in the report.
When I render the report in PDF or Excel the image is there. When I preview the report in Visual Studio the image is there. I have tried embedded images, project images, external URL - all with the same results.
Anyone see this before?
Also, when I run the report right on the server in the report viewer control it looks fine. What am I doing wrong?
Thanks
~BC
August 1, 2007 at 8:50 pm
Hi,
We also had faced such an issue. We were creating a html render of the report to print the report. The html is not able to get the image and render for some reason. So what we did was that after rendering we replaced the image path in th report with the same image in the project. The code that we have used is just added for reference. This is a work around, but we had searched for a lot of sloutions and this was the only one that worked.
byte
[] renderedReportOutput;
renderedReportOutput = reportingService.Render(reportURL.ToString(), "HTML4.0", null, deviceInformation.ToString(), reportParameters, null,null, out outputEncoding, out outputMimeType, out outputUsedParameters, out outputWarnings, out outputStreamIDs);
string reportData;
int removalStartIndex;
reportData = (new StreamReader(new MemoryStream(renderedReportOutput))).ReadToEnd();
removalStartIndex = reportData.IndexOf("<IMG");
reportData = reportData.Remove(removalStartIndex, reportData.IndexOf(">", removalStartIndex) - removalStartIndex + 1);
reportData = reportData.Insert(removalStartIndex, "<IMG SRC=\"" + ConfigurationSettings.AppSettings[GlobalConstants.APPLICATION_URL] + "/Images/Logo.jpg\">");
reportData = reportData.Replace("<hr/>","");
Hope this works. If you find a better solution then please do mention. Have a nice day
Sameer
August 3, 2007 at 1:56 pm
Thanks for the response - we actually engineered a very similar work around here. From what I can figure this is the only way to do this.
Thanks.
March 18, 2008 at 9:56 am
So where do you put this code?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply