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

HtmlFormatProvider Exception

1 Answer 86 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
keith schaefer
Top achievements
Rank 1
keith schaefer asked on 07 Oct 2010, 05:48 PM
Hi,

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" >
    <Controls:RadRichTextBox.Document>
        <Model:RadDocument>
        </Model:RadDocument>
    </Controls:RadRichTextBox.Document>
</Controls:RadRichTextBox>

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 !

1 Answer, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 08 Oct 2010, 02:54 PM
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,
Alex
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
Tags
RichTextBox
Asked by
keith schaefer
Top achievements
Rank 1
Answers by
Alex
Telerik team
Share this question
or