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

Error while displaying unvalidated Html tags in HTMLTextbox

6 Answers 512 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shalini Vijayakumar
Top achievements
Rank 1
Shalini Vijayakumar asked on 26 Aug 2010, 04:40 PM
Hi,

I have a Windows application which uses the Telerik Reporting for displaying reports. 
  1. The Windows application has many comment fields (contains rich text - data copied from Word, Exel, PDF).
  2. The comments data could contain Chinese, European, Indian etc alphabets.
  3. Styles like Font change, Bold, italics, highlights can be applied to the comment fields

4.   The data is stored in the Access Database

Issues are as follows:

When these comment fields are to be displayed in the Reports--> HTMLTextBox, (since richtext htmlTextbox is used) error occurs as the HtmlTextBox is unable to identify the html tags (mostly generated by Word, Excel and Pdf).

Steps Followed

  1. Place the HTMLTextbox controls in the detail section of the Reports
  2. HTMLTextBox --> Properties   --> Value --> Bind the Comment field from the database to the control
  3. Properties -- > Change the Font to Arial Unicode MS to accept other language characters
  4. Build report.
  5. This report is called from the Windows Application.

Please find attached a sample HTML generated from the Word and the error occured.

Please note..
When these Html generated tags is directly copied into the Design View of  Editor properties of the [HTMLTextBox--> Value ]
and switch back to HTML mode, they are displayed fine when you Preview from the Report project (like harcoding) . I have noticed that the Design view of the Editor Properties validates the HTML to proper Html tags. But the HTMLTextBox as such fails to do the same.

The reports needed for the application is dynamic data.

Please need a solution to this..

Thanks
Shalini

Sample HTML

<SPAN FONT-SIZE: 16px""><SPAN lang=DE COLOR: black; FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-size: 10.0pt; mso-bidi-font-family: Arial;

mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""><STRONG><SPAN lang=DE COLOR: black; FONT-FAMILY: 'Arial Unicode MS';

mso-bidi-font-size: 10.0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">智信有限公司</SPAN><SPAN COLOR: black;

FONT-FAMILY: Arial; mso-bidi-font-family: Arial; mso-fareast-font-family: 'Arial Unicode MS'"">(CHEERSIN LIMITED)<?xml:namespace prefix = o ns =

""urn:schemas-microsoft-com:office:office"" /><o:p></o:p></SPAN></STRONG></P>
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""><SPAN lang=DE COLOR: black; FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-size:

10.0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">智信工程有限公司</SPAN><SPAN COLOR: black; FONT-FAMILY: Arial;

mso-bidi-font-family: Arial; mso-fareast-font-family: 'Arial Unicode MS'"">(WISE FAITH ENGINEERING LIMITED)<o:p></o:p></SPAN></P>
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""><SPAN lang=DE COLOR: black; FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-size:

10.0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">智信企業有限公司</SPAN><SPAN COLOR: black; FONT-FAMILY: Arial;

mso-bidi-font-family: Arial; mso-fareast-font-family: 'Arial Unicode MS'"">(CHEER VISION ENTERPRISES LIMITED)<o:p></o:p></SPAN></P>
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""><EM><SPAN lang=DE COLOR: black; FONT-FAMILY: 'Arial Unicode MS';

mso-bidi-font-size: 10.0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">智信行有限公司</SPAN><SPAN COLOR: black;

FONT-FAMILY: Arial; mso-bidi-font-family: Arial; mso-fareast-font-family: 'Arial Unicode MS'"">(FAITH KIND COMPANY LIMITED)<o:p></o:p></SPAN></EM></P>
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""><SPAN COLOR: #ff8040; FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-size: 10.0pt;

mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial""><SPAN lang=DE FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-size: 10.0pt;

mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">智信技研有限公司</SPAN><SPAN FONT-FAMILY: Arial; mso-bidi-font-family:

Arial; mso-fareast-font-family: 'Arial Unicode MS'"">(NETECIS ENGINEERING LIMITED)</SPAN></SPAN></P>
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""><SPAN lang=DE COLOR: black; FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-size:

10.0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">智信技術有限公司</SPAN><SPAN COLOR: black; FONT-FAMILY: Arial;

mso-bidi-font-family: Arial; mso-fareast-font-family: 'Arial Unicode MS'"">(SMARTCOMM TECHNOLOGIES CO., LIMITED)<o:p></o:p></SPAN></P>
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""><SPAN lang=DE COLOR: black; FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-size:

10.0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">智信科技有限公司</SPAN><SPAN COLOR: black; FONT-FAMILY: Arial;

mso-bidi-font-family: Arial; mso-fareast-font-family: 'Arial Unicode MS'"">(WISE HONOUR TECHNOLOGIES LIMITED)<o:p></o:p></SPAN></P>
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""><SPAN lang=DE COLOR: black; FONT-FAMILY: 'Arial Unicode MS'; mso-bidi-font-size:

10.0pt; mso-bidi-font-family: Arial; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"">智信科技香港有限公司</SPAN><SPAN COLOR: black; FONT-FAMILY:

Arial; mso-bidi-font-family: Arial; mso-fareast-font-family: 'Arial Unicode MS'"">(WISE MICROTEK CO., LIMITED)<o:p></o:p></SPAN></P>
<P MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify""></SPAN></SPAN></P>

6 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 27 Aug 2010, 02:49 PM
hi,Shalini

please remove this "<o:p></o:p>" from  your HTML code.

Check this link for supported HTML tag and STYLE in HTMLtextbox ..http://www.telerik.com/help/reporting/report-items-html-text-box.html

check this for language issue...http://www.telerik.com/community/forums/reporting/documentation/export-to-pdf-arabic-persian-language-problem.aspx
0
Shalini Vijayakumar
Top achievements
Rank 1
answered on 01 Sep 2010, 02:19 PM
Hi,

Removing  "<o:p></o:p>" tag does not solve the issue for me. I get another error for other tags which is not recognized by HTMLTextbox.
Also using TextBox instead of HTMLText does not solve because as i mentioned I have rich styles to be displayed and printed like (BOLD, italic, underline, font color change) which the Textbox control cannot display.

Is there any other way of solving this issue? Why is the HTMLTextbox not able to validate the HTML tags. This is a common feature in any HTML Editor.

Please help
--Shalini
0
Vassil Petev
Telerik team
answered on 03 Sep 2010, 10:06 AM
Hello Shalini Vijayakumar,

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 foramts. 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:
  • 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
I would like once again to stress that TR is supposed to render exclusively data and charts, rather than text. The rich-text formatting options are available for the sole purpose of styling labels and headers.

SOLUTION
The solution is to use content filters that will remove all HTML tags except those understood by the Reporting export engine. This is done by using Regular Expressions. You can do this either before saving Word's HTML in the data base, or before passing the HTML to TR - it is up to you.

I hope this will assist you with the issues you are facing.


Best wishes,
Vassil
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jason Horspool
Top achievements
Rank 1
answered on 06 Nov 2010, 07:22 PM
Vassil,
While I understand completely the complexities of supporting all HTML tags in your report, I think you are missing a few basic ingredients to put the HTMLTextBox to real use (at least in our case).  This being any support for positioning the text item inside the HTMLTextBox.  Simply adding support for tables (which seem more rudimentary than DIV's) would solve a lot of concern with the control -or- supporting a few more enhancements to the div or span styles.  Currently the div does not support any of the positioning styles nor does the span maintain any sizing.

Last thought, this is a great product but it currently can't solve our problem which may not be the "norm" for the control but I hope software developers are always thinking outside the box to solve problems.

Just my two cents!

Regards,
Jason
0
Steve
Telerik team
answered on 10 Nov 2010, 08:20 PM
Hello Jason,

Currently the HtmlTextBox supports text-align (center, left and right only) and text-indent. Can you share which css attributes you would like supported as well?

Best wishes,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jason Horspool
Top achievements
Rank 1
answered on 10 Nov 2010, 08:50 PM
It would be nice if we could use the <table><tr><td> tags or some method to align the div or span tags in a row (column) like fashion. Currently you can't do this without supporting "inline" styles for the div or size styles for the span tag.

We have a dynamic data engine that builds up a header report in HTML format, we would then like to simply merge or display that information in a standard Telerik Report that uses the standard Report controls.  We have our own designer for our end users to configure the dynamic data portion of the report, hence the reason we don't just use a table in the Telerik Report.

We have had to resort to a competitors product that has rich support for html tags with lots of CSS styles, etc, but we would love to keep it all in the Telerik suite.  We think you have a much cleaner interface and method of integrating our data.
Tags
General Discussions
Asked by
Shalini Vijayakumar
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Shalini Vijayakumar
Top achievements
Rank 1
Vassil Petev
Telerik team
Jason Horspool
Top achievements
Rank 1
Steve
Telerik team
Share this question
or