RichTextBox Format issues

3 posts, 0 answers
  1. Gopinath
    Gopinath avatar
    63 posts
    Member since:
    Sep 2011

    Posted 24 Jan 2014 Link to this post

    Hi,

    I am trying to load a document using HtmlDataProvider and RichTextBox.
    But i am facing some format issues.

    HTML Content Used
    <html xmlns="http://www.w3.org/1999/xhtml"><head><style type="text/css"> <!--TH{FONT-WEIGHT: bold; FONT-SIZE: 10 pt; COLOR: black; FONT-FAMILY: Arial, sans-serif; TEXT-ALIGN: center} TD{ FONT-WEIGHT: normal; FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial, sans-serif; TEXT-DECORATION: none}TD.test{ TEXT-ALIGN: left}TD.short_name{ TEXT-ALIGN: left}TD.cas_num{ TEXT-ALIGN: left} TD.numeric{ TEXT-ALIGN: right}TD.flag{ TEXT-ALIGN: center}H1{ FONT-WEIGHT: bold; FONT-SIZE: 14 pt; COLOR: black; FONT-FAMILY: Arial, sans-serif; TEXT-ALIGN: left}H2{ FONT-WEIGHT: bold; FONT-SIZE: 12 pt; COLOR: black; FONT-FAMILY: Arial, sans-serif; TEXT-ALIGN: left}H3{ FONT-WEIGHT: bold; FONT-SIZE: 10 pt; COLOR: black; FONT-FAMILY: Arial, sans-serif; TEXT-ALIGN: left}H4{ FONT-WEIGHT: normal ; FONT-SIZE: 9 pt; COLOR: black; FONT-FAMILY: Arial, sans-serif; TEXT-ALIGN: left} body { FONT-WEIGHT: normal; FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: Arial, sans-serif; TEXT-ALIGN: left;} --> </style> </head><body><div style="background-color: white"><H2><B><CENTER>EE Acute Summation Processor</CENTER></B></H2><BR />
    <TABLE CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TD >User: gopinath ravuri</TD>
    <TD ALIGN="RIGHT">Date & Time: 1/8/2014 7:39:51 AM</TD></TR></TABLE><BR /><BR />
    <H4>Material Short Name: <B>Laura Novec 1230</B><BR />
    Status: <B>Draft</B><BR />
    Reg. Agency: <B>GHS - (GHS)</B><BR /><BR />  The Acute Summation Calculation results are displayed in the GHS Calculations Detail Window.<BR />
    </H4>
    <HR /><H2><B><CENTER>EE Percent Unknown Processor</CENTER></B></H2><BR /><TABLE CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TD >User: gopinath ravuri</TD><TD ALIGN="RIGHT">Date and Time: 1/8/2014 7:39:55 AM</TD></TR></TABLE><BR /><BR /><H4>Material Short Name: <B>Laura Novec 1230</B><BR />Status: <B>Draft</B><BR />Reg. Agency: <B>GHS - (GHS)</B><BR />GHS Relational Deblend Type: <B>GHS Relational Comp</B></H4><TABLE BORDER="2" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TH ALIGN="CENTER">COMPONENT</TH><TH ALIGN="CENTER">%W</TH><TH ALIGN="CENTER">DATA LEVEL<br/>FLAG CHECKED<br/>(FOR ANY<br/>SPECIES, ACUTE<br/>OR CHRONIC)</TH><TH ALIGN="CENTER">INVALID/<br/>MISSING<br/>ECO TOX<br/>DATA?</TH><TH ALIGN="CENTER">MISSING<br/>BASE CHEM<br/>CLASS. DATA?</TH><TH ALIGN="CENTER">CONTAINS<br/>EE %UNKNOWN<br/>NON-MATERIAL?</TH><TH ALIGN="CENTER">CONTRIBUTING<br/>% UNKNOWN</TH></TR><TR><TD class="short_name">Laura Novec 1230</TD><TD class="numeric">100</TD><TD class="flag">N</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">N</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbspCF3CF2CO2CH3</TD><TD class="numeric">0.05</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">Y</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CH-CO-CF2CF3</TD><TD class="numeric">0.01</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">Y</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CH-CF2CF2CF3</TD><TD class="numeric">0.05</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">Y</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CF-CO2CH3</TD><TD class="numeric">0.05</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">Y</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp1,1,1,2,2,4,5,5,5-NONAFLUORO-4-(TRIFLUOROMETHYL)-3-PENTANONE</TD><TD class="numeric">100</TD><TD class="flag">-</TD><TD class="flag">N</TD><TD class="flag">N</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR></TABLE><H3>EE Percent Unknown Processor Results:</H3><H4>Total Percent Unknown: <B>0%</B><BR /></H4><HR />
    <H2><B><CENTER>EE Chronic Summation Processor</CENTER></B></H2><BR />
    <TABLE CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TD >User: gopinath ravuri</TD>
    <TD ALIGN="RIGHT">Date & Time: 1/8/2014 7:40:00 AM</TD></TR></TABLE><BR /><BR />
    <H4>Material Short Name: <B>Laura Novec 1230</B><BR />
    Status: <B>Draft</B><BR />
    Reg. Agency: <B>GHS - (GHS)</B><BR /><BR />  The Chronic Summation Calculation results are displayed in the GHS Calculations Detail Window.<BR />
    </H4>
    <HR /><H2><B><CENTER>EE Percent Unknown Processor</CENTER></B></H2><BR /><TABLE CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TD >User: gopinath ravuri</TD><TD ALIGN="RIGHT">Date and Time: 1/8/2014 7:40:03 AM</TD></TR></TABLE><BR /><BR /><H4>Material Short Name: <B>Laura Novec 1230</B><BR />Status: <B>Draft</B><BR />Reg. Agency: <B>GHS - (GHS)</B><BR />GHS Relational Deblend Type: <B>GHS Relational Comp</B></H4><TABLE BORDER="2" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TH ALIGN="CENTER">COMPONENT</TH><TH ALIGN="CENTER">%W</TH><TH ALIGN="CENTER">DATA LEVEL<br/>FLAG CHECKED<br/>(FOR ANY<br/>SPECIES, ACUTE<br/>OR CHRONIC)</TH><TH ALIGN="CENTER">INVALID/<br/>MISSING<br/>ECO TOX<br/>DATA?</TH><TH ALIGN="CENTER">MISSING<br/>BASE CHEM<br/>CLASS. DATA?</TH><TH ALIGN="CENTER">CONTAINS<br/>EE %UNKNOWN<br/>NON-MATERIAL?</TH><TH ALIGN="CENTER">CONTRIBUTING<br/>% UNKNOWN</TH></TR><TR><TD class="short_name">Laura Novec 1230</TD><TD class="numeric">100</TD><TD class="flag">N</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">N</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbspCF3CF2CO2CH3</TD><TD class="numeric">0.05</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">Y</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CH-CO-CF2CF3</TD><TD class="numeric">0.01</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">Y</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CH-CF2CF2CF3</TD><TD class="numeric">0.05</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">Y</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CF-CO2CH3</TD><TD class="numeric">0.05</TD><TD class="flag">-</TD><TD class="flag">-</TD><TD class="flag">Y</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp1,1,1,2,2,4,5,5,5-NONAFLUORO-4-(TRIFLUOROMETHYL)-3-PENTANONE</TD><TD class="numeric">100</TD><TD class="flag">-</TD><TD class="flag">N</TD><TD class="flag">N</TD><TD class="flag">-</TD><TD class="numeric">-</TD></TR></TABLE><H3>EE Percent Unknown Processor Results:</H3><H4>Total Percent Unknown: <B>0%</B><BR /></H4><HR />
    <HR /><H2><B><CENTER>Acute Toxicity Estimate (ATE) Processor</CENTER></B></H2><BR /><TABLE CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TD >User: gopinath ravuri</TD><TD ALIGN="RIGHT">Date & Time: 1/8/2014 7:40:13 AM</TD></TR></TABLE><H4>Material Short Name: <B>Laura Novec 1230</B><BR />Status: <B>Draft</B><BR />Reg. Agency: <B>GHS - (GHS)</B><BR />GHS Relational Deblend Type: <B>GHS Relational Comp</B></H4><H3><B><CENTER>ORAL</CENTER></B></H3><H4>Ingredients, Percents and ATE Information for the ATE calculation:</H4><TABLE BORDER="2" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TH ALIGN="CENTER">COMPONENT</TH><TH ALIGN="CENTER">CAS #</TH><TH >%W</TH><TH ALIGN="CENTER">ATE INFORMATION</TH><TH ALIGN="CENTER">RATIO USED</TH><TH ALIGN="CENTER">REASON</TH></TR><TR><TD class="short_name">Laura Novec 1230</TD><TD class="cas_num">NONE</TD><TD class="numeric">100</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Data Level unchecked.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbspCF3CF2CO2CH3</TD><TD class="cas_num">-</TD><TD class="numeric">0.05</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Not a "Relevant" ingredient.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CH-CO-CF2CF3</TD><TD class="cas_num">-</TD><TD class="numeric">0.01</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Not a "Relevant" ingredient.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CH-CF2CF2CF3</TD><TD class="cas_num">-</TD><TD class="numeric">0.05</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Not a "Relevant" ingredient.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CF-CO2CH3</TD><TD class="cas_num">-</TD><TD class="numeric">0.05</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Not a "Relevant" ingredient.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp1,1,1,2,2,4,5,5,5-NONAFLUORO-4-(TRIFLUOROMETHYL)-3-PENTANONE</TD><TD class="cas_num">756-13-8</TD><TD class="numeric">100</TD><TD class="text">Classification: ORAL_5 (2500 mg/kg)</TD><TD class="numeric">100/2500</TD><TD class="text">Invalid/missing GHS ATE or Limit Dose value.  </TD></TR></TABLE><H3><B>Results (ATE Equation Used):</B></H3><H4>ATE<sub>mix</sub> = 100/(100/2500) = <B>2500 mg/kg</B><BR />GHS Classification: <B>ORAL_5</B><BR />Percent Unknown: <B>0%</B><BR /></H4><H3><B><CENTER>DERMAL</CENTER></B></H3><H4>Ingredients, Percents and ATE Information for the ATE calculation:</H4><TABLE BORDER="2" CELLPADDING="2" CELLSPACING="2" WIDTH="100%"><TR><TH ALIGN="CENTER">COMPONENT</TH><TH ALIGN="CENTER">CAS #</TH><TH >%W</TH><TH ALIGN="CENTER">ATE INFORMATION</TH><TH ALIGN="CENTER">RATIO USED</TH><TH ALIGN="CENTER">REASON</TH></TR><TR><TD class="short_name">Laura Novec 1230</TD><TD class="cas_num">NONE</TD><TD class="numeric">100</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Data Level unchecked.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbspCF3CF2CO2CH3</TD><TD class="cas_num">-</TD><TD class="numeric">0.05</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Not a "Relevant" ingredient.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CH-CO-CF2CF3</TD><TD class="cas_num">-</TD><TD class="numeric">0.01</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Not a "Relevant" ingredient.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CH-CF2CF2CF3</TD><TD class="cas_num">-</TD><TD class="numeric">0.05</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Not a "Relevant" ingredient.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp(CF3)2-CF-CO2CH3</TD><TD class="cas_num">-</TD><TD class="numeric">0.05</TD><TD class="text">-</TD><TD class="text">-</TD><TD class="text">Not a "Relevant" ingredient.  </TD></TR><TR><TD class="short_name">&nbsp&nbsp&nbsp1,1,1,2,2,4,5,5,5-NONAFLUORO-4-(TRIFLUOROMETHYL)-3-PENTANONE</TD><TD class="cas_num">756-13-8</TD><TD class="numeric">100</TD><TD class="text">Classification: DERMAL_5 (2500 mg/kg)</TD><TD class="numeric">100/2500</TD><TD class="text">Invalid/missing GHS ATE or Limit Dose value.  </TD></TR></TABLE><H3><B>Results (ATE Equation Used):</B></H3><H4>ATE<sub>mix</sub> = 100/(100/2500) = <B>2500 mg/kg</B><BR />GHS Classification: <B>DERMAL_5</B><BR />Percent Unknown: <B>0%</B><BR /></H4><HR />
    </div></body></html>

    Below is the XML code.  ResultLog holds the above Html content

    <telerikHtml:HtmlDataProvider x:Name="htmlDataProvider" Html="{Binding ResultLog, Mode=TwoWay}"
                    RichTextBox="{Binding ElementName=GhsDocumentViewer}">
                    <telerikHtml:HtmlDataProvider.FormatProvider>
                        <telerikHtml:HtmlFormatProvider>
                            <telerikHtml:HtmlFormatProvider.ExportSettings>
                                <telerikHtmlMain:HtmlExportSettings DocumentExportLevel="Fragment" StylesExportMode="Inline" />
                            </telerikHtml:HtmlFormatProvider.ExportSettings>
                        </telerikHtml:HtmlFormatProvider>
                    </telerikHtml:HtmlDataProvider.FormatProvider>
                </telerikHtml:HtmlDataProvider>
                <telerik:RadRichTextBox x:Name="GhsDocumentViewer" Width="1012" Height="558"
                    HorizontalAlignment="Left" VerticalAlignment="Top" IsImageMiniToolBarEnabled="True" 
                    IsSelectionMiniToolBarEnabled="False" IsSpellCheckingEnabled="False"
                    ScrollViewer.HorizontalScrollBarVisibility="Auto"
                    ScrollViewer.VerticalScrollBarVisibility="Auto" />

    Same works perfectly with RadHtmlPlaceholder as shown in the below. But due to some project restrictions i am not using this.
    <telerik:RadHtmlPlaceholder x:Name="GhsDocumentViewer" Width="1012" Height="558" HorizontalAlignment="Left" 
                                            VerticalAlignment="Top" HtmlSource="{Binding ResultLog}" />

    Anyone please help me in this?

    Thanks
    Gopinath
  2. Gopinath
    Gopinath avatar
    63 posts
    Member since:
    Sep 2011

    Posted 29 Jan 2014 in reply to Gopinath Link to this post

    Can any one please help me on this? I am stuck in between.
  3. DevCraft banner
  4. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 29 Jan 2014 Link to this post

    Hello Gopinath,

     Before getting to the problem I would like to clarify that RadRichTextBox has limited support for html at this point. More about what is supported you can read in this article: HTML Support. In addition I would like to point out that with every new version of our control we are trying to improve the html support. 

    Here are my findings regarding your document:
    • "font-size: 10 pt" - this is part from the css styles, and the html parser couldn't identify that the font size is set in points due to the additional space between the number and the points abbreviation.
    • <center> tag - RadRichTextBox does not support this tag, as a workaround you could apply the "text-align" styling to the paragraph.
    • <b> tag inside <h4> - the behavior is that all of the text inside <h4> is bolded. This is bug and it is observed only for heading tags. You can work around this by using paragraph with styling.
    • <hr> tag - unfortunately this tag is not supported and there is no workaround .
    • <th> vertical align - In RadRichTextBox the default value is top, you could set it explicitly to middle if you need the text to be vertically aligned in the middle. You can use the "valign" attribute of the table cell or the css property "vertical-align".
    Our recommendation is to use and style paragraphs and spans whenever it's possible. Additional to that we can recommend you to use only lowercase letters for the tags and styling.

    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 >>
Back to Top