HtmlFormatProvider Exception

2 posts, 0 answers
  1. keith schaefer
    keith schaefer avatar
    8 posts
    Member since:
    Feb 2010

    Posted 07 Oct 2010 Link to this post


    I am trying to import HTML into a RichTextBox using HtmlFormatProvider.
     It is throwing an exception
    {System.NullReferenceException: Object reference not set to an instance of an object.
     This is the Code i am using

    var provider = new HtmlFormatProvider();
    OpenFileDialog openDialog = new OpenFileDialog();
    openDialog.Multiselect = false;
    bool? dialogResult = openDialog.ShowDialog();
    if (dialogResult == true) {
        using (FileStream stream = openDialog.File.OpenRead()) {
            stream.Seek(0, SeekOrigin.Begin);
            rich.Document = provider.Import(stream);
    This is my XAML
    <Controls:RadRichTextBox  x:Name="rich" >

    This is the HTML i am trying to import
    <HTML> <BODY> Test Html </BODY> </HTML>

    This is the Stack Trace.

       at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
       at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)
       at System.Windows.UIElement.UpdateLayout()
       at Telerik.Windows.Documents.UI.DocumentPresenterBase.UpdateEditorLayout()
       at Telerik.Windows.Documents.UI.DocumentPresenterBase.DoOnDocumentChanged()
       at Telerik.Windows.Documents.UI.DocumentPresenterBase.OnOwnerChanged()
       at Telerik.Windows.Documents.UI.DocumentPresenterBase.set_Owner(RadRichTextBox value)
       at Telerik.Windows.Controls.RadRichTextBox.InitActiveEditorPresenter()
       at Telerik.Windows.Controls.RadRichTextBox.set_Document(RadDocument value)
       at SilverlightApplication1.MainPage.Button_Click_1(Object sender, RoutedEventArgs e)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
       at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
       at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
       at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)

    Thanks !

  2. Alex
    Alex avatar
    130 posts

    Posted 08 Oct 2010 Link to this post

    Hello keith schaefer,

    There were some issues with the HtmlFormatProvider in the Q2 release. Fortunately we have made many improvements since then. I recommend you to upgrade your version to Q2 SP2 and see if your problems are solved.

    Please, let us know if this works for you.

    Kind regards,
    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
Back to Top