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

HTML Format Provider load contains CSS stylesheet format

4 Answers 332 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Naoya
Top achievements
Rank 1
Naoya asked on 05 Dec 2013, 08:27 AM

I tried to load the html document file contains CSS style-sheet to RadRichTextBox via
HTML Format Provider class of 2013 Q2 library.
This file is generated by MS-Word 2010. Example Following html document.

Ex1)

  <html>
   <head>
    <style>
     <!--
     p.1 {font-size:28.0pt;}
     -->
    </style>
   </head>
    <body lang=JA style='text-justify-trim:punctuation'>
    <div class=WordSection1 style='layout-grid:18.0pt'>
    <p class=1>Sample Strings</p>
    </div>
    </body>
  </html>

It's not applied to CSS style sheet format (font-size:28.0pt).
But the online manual says "Styling is supported through CSS styles (classes or inline)" at
http://www.telerik.com/help/silverlight/radrichtextbox-features-html-support.html

So I tried to load the following HTML document edited by hand.

Ex2)

  <html>
   <head>
    <style>
     p.hoge {font-size:28.0pt;}
    </style>
   </head>
    <body lang=JA style='text-justify-trim:punctuation'>
    <div class=WordSection1 style='layout-grid:18.0pt'>
    <p class=hoge>Sample Strings</p>
    </div>
    </body>
  </html>

It's loaded appropriately.
Could you tell me about the folowing quenstions.

1. Is it not supported by Telerik HTML Format Provider class loading CSS style sheet?

2. What is the best-way to avoid this problem.

4 Answers, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 09 Dec 2013, 03:21 PM
Hello Naoya,

If you create html file from Ex1) and open it in Chrome, FF or IE, you will notice that they do not respect the p.1 class. The reason behind this is the invalid name of the class. The identifier of the class name could not start with digit. For more information on the subject you can read the CSS specification by W3C.

I hope this information answers your questions.

Regards,
Mihail
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Naoya
Top achievements
Rank 1
answered on 10 Dec 2013, 05:09 AM

Hello Mihail.
Thank you for answer my question.
But this situation is more complex.

Firstly, Yes I know above html sample Ex1) is not respect for W3C specification refer to CSS Selector name.
But this file generated by MS-Word 2010 and I dare to upload it
because of respecting for peculiar Microsoft rule.
(Sorry, I forgot to describe this special case.)
Your suggestion is correct, this special CSS selector name "p.1" is invalid and should be repared.
So I already tried to develop code to rename this selector name intermidiately.
Thank you.

Thecondly, I tried to load below sample Ex3) is edited CSS selector name p.1 to p.hoge.
But Telerik Html Format Provider class does not apply for CSS style sheet parameter.

Ex3)
  <html>
   <head>
    <style>
     <!--
     p.hoge {font-size:28.0pt;}
     -->
    </style>
   </head>
    <body lang=JA style='text-justify-trim:punctuation'>
    <div class=WordSection1 style='layout-grid:18.0pt'>
    <p class=hoge>Sample Strings</p>
    </div>
    </body>
  </html>

This Ex3) and above Ex2) are different in using CSS Style Sheet not CSS Style.
CSS Style Sheet is comment out terms <!-- --> for old web browsers they are not support CSS Style.

So I want to ask most important thing
that Telerik Html Format Provider is support OR not support for CSS Style Sheet.

If It's not support Style Sheet then I need to fix my code to convert from CSS Style Sheet to pure CSS Style.
If It is (OR will be) support Style Sheet, and I don't understand wise way to avoid this problem, Please tell me.

0
Mihail
Telerik team
answered on 12 Dec 2013, 01:11 PM
Hello Naoya,

 At this point HtmlFormatProvider does not support any css styling which is commented out. If you want to show those files properly you should preprocess the files and remove the comment symbols.

Regards,
Mihail
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Naoya
Top achievements
Rank 1
answered on 13 Dec 2013, 06:15 AM

Hi, Mihail

Thank you for your response.
I fixed my code to unfolde CSS Style-sheet Properties to Inline style attribute.
Then It works.

Thank you.
//

Tags
RichTextBox
Asked by
Naoya
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Naoya
Top achievements
Rank 1
Share this question
or