This is a migrated thread and some comments may be shown as answers.

Display the content of rich textbox in Report

2 Answers 1041 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joerg
Top achievements
Rank 1
Joerg asked on 30 Nov 2011, 12:07 PM
I have a Silverlight project with a Telerik Rad Control Rich Text Box. The content of the rich text box is first exported in a string variable like this 

public string ExportToXAML(RadDocument document)  

XamlFormatProvider provider = new XamlFormatProvider();  

return provider.Export(document);  

}
After this, it is converted to a byte[] datatype and stored in an Oracle Database with a WCF webservice as a blob datatype (large business object). This works fine without problems. The content which is saved in the database is also shown in the rich text box with a get method of the webservice.
My question is: Is it possible to display the content of the rich text box in a Telerik report. I have constructed a Dataobjectmethod as a separate class, build an objectdatasource with the Dataobjectmethod and at last bound the report´s datasource to the objectdataource. Now when I try to generate the report preview an error is thrown: "Object reference not set to an object instance"
Actually it is not only the large BLOB object which is not displayed, but also the normal text is not shown. Do you have any idea about the error and how to handle it?
And: Is there a rich text box in the reporting or if not, how can I display the content of a rich text box in the report?

2 Answers, 1 is accepted

Sort by
0
Joerg
Top achievements
Rank 1
answered on 05 Dec 2011, 08:56 AM
Is there no idea at all? My urgent question to the Telerik Team: How can I display the content of a Rad Rich textbox in a Telerik Report? Which control has to be used for that purpose? Is there any sample code available. Our company´s decision whether we buy a Telerik licence or we look for another tool depends on that question. Please help.
0
Peter
Telerik team
answered on 05 Dec 2011, 04:57 PM
Hello Joerg,

Currently the report designer can't get the schema of the data source because of WCF RIA services' peculiarities. Thus be aware that the available wizards and Data Explorer would not be populated with data source fields and both Previews would not work. For more information check out the Using Telerik Reporting with WCF RIA Services help article.

Let me start by stressing that Telerik Reporting is a reporting engine and not a printing library, so rendering HTML produced by RadEditor, RadRichTextBox or any other 3rd party or home grown control is not among our goals.

I would state the obvious: Telerik Reporting is not able and does not have to render all HTML tags and CSS attributes. Support for all HTML tags and css attributes would mean that we will need to develop an HTML engine which will be responsible for rendering this HTML before it hits the client. In other words, we will need to develop a fully functional browser. You see that this task goes completely out of the scope of a reporting product, moreover it is not trivial at all and quite frankly we (the reporting team) do not have the resources and intention to go this way. In fact even Microsoft does not do this in their SQL Reporting Services product.

The existence of the HtmlTextBox is solely based on the need to render a small subset of HTML tags and CSS attributes to support the most common text formatting options:

  • Supported HTML tags:
        * Font, size (relative size against the font size of the item, default is 3 (1-7)), color (<FONT>)
        * Bold, Italic, Underline (<STRONG>,<B>, <EM>, <I>, <U>)
        * HyperLink (<A href target>)
        * Lists (<OL>, <UL>, <LI>)
        * Organize the text in paragraphs (<DIV>, <SPAN>,<P>, <BR>, <CENTER>)
  • Supported css attributes:
        * background-color
        * border-color, border-width, border-style
        * text-align (center, left and right only), text-indent
        * font-family, font-size, font-weight
        * padding, padding-bottom, padding-top, padding-right, padding-left
        * color
Telerik Reporting is supposed to render exclusively data and charts, rather than text. So the rich-text formatting options are available for the sole purpose of styling labels and headers.

Still we have prepared a sample project that is 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.

Regards,
Peter
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
General Discussions
Asked by
Joerg
Top achievements
Rank 1
Answers by
Joerg
Top achievements
Rank 1
Peter
Telerik team
Share this question
or