I'm a developer using C# and ASP.net. Let me first of all say that I know that HtmlTextBox does not currently support the <img> tag.
However, as I (and many others) have discovered, images are more or less essential when you want to generate good looking reports.
What I want to do is use RadEditor to create html pages in the admin part of the application, complete with formatting and images. This is fairly straghtforward and already done. In the viewing part of the application, a user can browse different pages and print/export to pdf.
At this stage I need to use Telerik Reporting to combine the html content with data and render the page/s as pdf exactly as it appears in the browser, plus some header and footer stuff.
My question is twofold:
1. Is there ANY way to accomplish this?
2. Do you really consider images to fall outside the scope of report generation when it comes to html content? If not, can you PLEASE implement image (and possibly table) handling in pdf?
Kind regards,
Stefan
8 Answers, 1 is accepted
We do understand that tables and images are essential part of the reports. Thus we do provide the PictureBox and Table item. However there are some limitations when working with HTML, which I will explain here.
Telerik Reporting (TR) is a server solution, which is intended to process and render data, rather than text (be it plain text or richly-formatted text). TR supports several export formats (one of which HTML), but they are all geared towards exporting tabular data and charts, rather than richly-formatted text.
This works in the following way: the reporting engine serves the report content in a predefined format to show it under the specific platform; for example, if you are using TR in a ASP.NET application, it uses a stream to serve HTML to the browser. It is important to note here that the report rendering happens before the content is served to the browser, i.e. the browser has nothing to do with the report rendering. The browser just shows the HTML, which has already been prepared by the report rendering.
If TR is to serve all HTML tags and CSS attributes (be them produced by Microsoft Word, RadEditor for ASP.NET, or RadRichTextBox for Silverlight), we will need to develop a HTML engine which to render this HTML before it hits the client. In other words, we will need to develop a fully functional browser which to process this HTML and CSS and either send it to the client report viewer, or export it to one of the supported formats. Developing a fully functional browser is neither easy nor viable (IE's HTML engine is roughly 10MB, whereas FF's is about 8MB; this is a lot of code). Even Microsoft does not do this in their SQL Reporting Services product.
This is the reason why TR renders a small subset of HTML tags and CSS attributes, all of which have been written by our developers to support the most common text formatting options
We have attached a sample project that illustrates the only possible approach we know of (workaround did not seem like the correct word here): utilizing the WebBrowser control to render HTML to a bitmap. We use an user defined function that does the trick, and a picture box item which displays the generated image (PNG). We're aware that this approach has several shortcomings and is far from perfect, but it seems to work in most cases and in all export formats (which support PictureBox items). One thing to note is that you should set the HTML as value for the browser.DocumentText property, in the example we've used URL from the RadEditor examples to quickly illustrate the approach.
Thank you for the understanding.
Regards,Peter
Telerik
Have you tried the new visualization options in Telerik Reporting Q2 2013? You can get them from your account.
It's been a couple of years since this reply was posted; is there any chance that you guys might implement this in the near future?
Sincerely,
Xavier.
Currently, we do not have any plans to support images in the HtmlTextBox item due to the limitations which my colleague described earlier in this thread.
However, you can still use images throughout your reports via the PictureBox report item or the workaround suggested in this thread.
Regards,
Nasko
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
In fact, there is a current feature request for this functionality in 'Under Review' status:
Support table and image tags in the htmltextbox
http://feedback.telerik.com/Project/162/Feedback/Details/126133-support-table-and-image-tags-in-the-htmltextbox
Our company would love to continue to use the full Telerik suite for all development and reporting needs, but we may have to look elsewhere to address this important need. Competing products, such as ActiveReports, purport to support the table and img tags in their RichTextBox controls. Does Telerik have any plans to ever support this functionality?
In order to support images, tables and other HTML tags, we will need to develop our own HTML layout engine similar to the ones used in the real web browsers. This may prove to be quite resource intensive and long term task. Having in mind that currently there is a solution for this issue (the WebBrowser control can be used to render HTML to a bitmap and display it in the report), we have to put our efforts and resources in other features which are critical or more related to data analysis.
Let us know if for some reason the WebBrowser to bitmap approach does not work in your scenario, so we can advise accordingly.
Regards,
Nasko
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Please find attached the updated HtmlToBitmap sample project using the Q1 2015 SP1 version of Telerik Reporting.
Regards,
Nasko
Telerik
See What's Next in App Development. Register for TelerikNEXT.