Hello,
I have a report which contains a PictureBox with an URL as value property.
When I export to PDF or Excel, the image is displayed with no problems.
However, when I try to export the report to HTML5 (which generate multiple streams), the image is not converted to an HTML tag (like <img>). What I see instead is something like this : "����JFIF��� ( %!1!%)+...383,7(-.+ ,$$,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,���� ...". It's the representation in text of the image.
Is there anyway to fix this problem?
Here is the code I use to export in HTML5:
I have a report which contains a PictureBox with an URL as value property.
When I export to PDF or Excel, the image is displayed with no problems.
However, when I try to export the report to HTML5 (which generate multiple streams), the image is not converted to an HTML tag (like <img>). What I see instead is something like this : "����JFIF��� ( %!1!%)+...383,7(-.+ ,$$,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,���� ...". It's the representation in text of the image.
Is there anyway to fix this problem?
Here is the code I use to export in HTML5:
//Method used for rendering the reportpublic List<Stream> GenerateTelerik(string languageCode = "en") { CultureInfo cultureInfo; cultureInfo = languageCode == "fr" ? new CultureInfo("fr-CA") : new CultureInfo("en-US"); // Set the language for static text (i.e. column headings, titles) System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo; // Set the language for dynamic text (i.e. date, time, money) System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo; var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); // set any deviceInfo settings if necessary var deviceInfo = new System.Collections.Hashtable(); var reportviewer = new Telerik.Reporting.InstanceReportSource { ReportDocument = _reportObject }; var renderType = getRenderType(_exportFormat); if (_exportFormat == ExportFormat.HTML5) { deviceInfo["OutputFormat"] = renderType; string documentName; var result = reportProcessor.RenderReport(renderType, reportviewer, deviceInfo, CreateStream, out documentName); if (result) { return _streams; } throw new Exception("Failed to export to HTML5"); } else { var result = reportProcessor.RenderReport(renderType, reportviewer, deviceInfo); _streams.Add(new MemoryStream(result.DocumentBytes)); return _streams; } }//For Handling multiple streamsStream CreateStream(string name, string extension, Encoding encoding, string mimeType) { string path = Path.GetTempPath(); string filePath = Path.Combine(path, name + "." + extension); FileStream fs = new FileStream(filePath, FileMode.Create); _streams.Add(fs); return fs; }//And when I want to render the HTML5 to the browser: (method in a controller in MVC application)private HttpResponseMessage GetHtml5ResponseMessage(List<Stream> streams, TelerikReporting.ExportFormat exportFormatTyped) { string data = string.Empty; foreach (var stream in streams) { StreamReader readStream = null; stream.Position = 0; readStream = new StreamReader(stream); data += readStream.ReadToEnd(); readStream.Close(); } return new HttpResponseMessage() { Content = new StringContent(data, Encoding.UTF8, getMIMEType(exportFormatTyped)) }; }