This question is locked. New answers and comments are not allowed.
I am trying to load html in RichTextBox control using HtmlDataProvider. The html contain style definitions defined within <Style> tag.
The RichTextBox fails to load the html with embedded <Style> tag.
Here is a sample html I am trying to load.
Can you tell me how to get it work.
Thanks
The RichTextBox fails to load the html with embedded <Style> tag.
Here is a sample html I am trying to load.
<!DOCTYPE><HTML><STYLE>P {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0in;text-indent:0.25in;font-weight:normal}P.freetext {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0in;text-indent:0in;font-weight:normal}P.outline {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0;text-indent:0in;font-weight:normal}P.outline1 {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0;text-indent:0in;font-weight:normal}P.outline2 {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0;text-indent:0in;font-weight:normal}P.outline3 {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0;text-indent:0in;font-weight:normal}H1 {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0in;text-indent:0in;font-weight:normal}H2 {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0in;text-indent:0in;font-weight:normal}H3 {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0in;text-indent:0in;font-weight:normal}H4 {margin-bottom:0in;margin-right:0in;margin-top:0in;margin-left:0in;text-indent:0in;font-weight:normal}UL {margin-top:0in;margin-bottom:0in;font-weight:normal}OL {margin-top:0in;margin-bottom:0in;font-weight:normal}A.a0:link {color: #000000; }A.a0:visited {color: #000000; }A.a80:link {color: #FF0000; }A.a80:visited {color: #FF0000; }</STYLE><HEAD><meta http-equiv="Content-Type" Content="text/html;charset=utf-8" ><TITLE></TITLE></HEAD><BODY TOPMARGIN="0" BGCOLOR=#FFFFFF><H1 ID="G20P1"><FONT FACE="Times New Roman" COLOR="#0000FF" SIZE="2"><B>Samle Text</B></FONT></H1><P CLASS=freetext ID="G20P2"><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2"><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2">sample sample sample</FONT>.</FONT></P><H1 ID="G13P1"><FONT FACE="Times New Roman" COLOR="#0000FF" SIZE="2"><B>Plan</B></FONT></H1><P ID="G13P2"><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2">Sample </FONT></P><UL><LI><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2">sample sample sample</FONT><LI><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2">Sample</FONT></UL><H1 ID="G27P1"><FONT FACE="Times New Roman" COLOR="#0000FF" SIZE="2"><B>Sample</B></FONT></H1><P CLASS=freetext ID="G27P2"><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2"><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2">sample</FONT>.</FONT></P><H1 ID="G62P1"><FONT FACE="Times New Roman" COLOR="#0000FF" SIZE="2"><B>Sample</B></FONT></H1><P CLASS=freetext ID="G62P2"><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2"><FONT FACE="Times New Roman" COLOR="#000000" SIZE="2">sample sample sample</FONT>.</FONT></P></BODY></HTML> Here is my code: <UserControl x:Class="HtmlViewerUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot"> <telerik:HtmlDataProvider Html="{Binding HtmlContent}" RichTextBox="{Binding ElementName=rtb}"> <telerik:HtmlDataProvider.FormatProvider> <telerik:HtmlFormatProvider> <telerik:HtmlFormatProvider.ExportSettings> <telerik:HtmlExportSettings DocumentExportLevel="Document" StylesExportMode="Inline"/> </telerik:HtmlFormatProvider.ExportSettings> </telerik:HtmlFormatProvider> </telerik:HtmlDataProvider.FormatProvider> </telerik:HtmlDataProvider> <telerik:RadRichTextBox x:Name="rtb" IsReadOnly="True" ShowComments="False" IsSelectionMiniToolBarEnabled="False" IsContextMenuEnabled="False" IsImageMiniToolBarEnabled="False" IsSelectionEnabled="False" IsSpellCheckingEnabled="False" ShowFormattingSymbols="False" ShowMergeFieldsHighlight="False" AllowScaling="True" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/> </Grid> </UserControl> |
Can you tell me how to get it work.
Thanks