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

PrintPreview() method in RichTextBox

3 Answers 136 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Anthony
Top achievements
Rank 1
Anthony asked on 17 Nov 2010, 05:54 AM
As in an example 
Dim instance As RadRichTextBox
 
instance.PrintPreview()
I am trying to print preview my current page , but runtime get an exception
System.InvalidOperationException was unhandled by user code
  Message=There is no DocumentFormatProvider which supports html
  StackTrace:
       at Telerik.Windows.Controls.RadRichTextBox.HtmlPrint(String title, Boolean preview)
       at Telerik.Windows.Controls.RadRichTextBox.PrintPreview()
       at SilverlightApplication1.MainPage.Button1_Click(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, Int32 actualArgsTypeIndex, String eventName)
  InnerException:
Did anybody meet it? and how to fix it up?
System.InvalidOperationException was unhandled by user code
  Message=There is no DocumentFormatProvider which supports html
  StackTrace:
       at Telerik.Windows.Controls.RadRichTextBox.HtmlPrint(String title, Boolean preview)
       at Telerik.Windows.Controls.RadRichTextBox.PrintPreview()
       at SilverlightApplication1.MainPage.Button1_Click(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, Int32 actualArgsTypeIndex, String eventName)
  InnerException: 
System.InvalidOperationException was unhandled by user code
  Message=There is no DocumentFormatProvider which supports html
  StackTrace:
       at Telerik.Windows.Controls.RadRichTextBox.HtmlPrint(String title, Boolean preview)
       at Telerik.Windows.Controls.RadRichTextBox.PrintPreview()
       at SilverlightApplication1.MainPage.Button1_Click(Object sender, RoutedEventArgs e)
       at System.Windows.Controls.Primitives.ButtonBase.OnClick()
       at System.Windows.Controls.Button.OnClick()
System.InvalidOperationException was unhandled by user code
  Message=There is no DocumentFormatProvider which supports html
  StackTrace:
       at Telerik.Windows.Controls.RadRichTextBox.HtmlPrint(String title, Boolean preview)
       at Telerik.Windows.Controls.RadRichTextBox.PrintPreview()
       at SilverlightApplication1.MainPage.Button1_Click(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, Int32 actualArgsTypeIndex, String eventName)
  InnerException:

3 Answers, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 17 Nov 2010, 11:46 AM
Hello Anthony,

The PrintPreview method uses HTML to show the document in a newly opened window. Therefore, it needs an implementation of a format provider which exports to HTML. All you need to do is add a reference to the Telerik.Windows.Documents.FormatProviders.Html.dll assembly and the exception should go away.

Kind regards,
Ivailo
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
Raphael
Top achievements
Rank 1
answered on 02 Dec 2010, 12:27 PM
Hi Iva!

I'm having the same problem but I'm using the Telerik.Windows.Documents.FormatProviders.Html.dll.

I add the dll on Xaml and Xaml.cs but the Html print and PrintPreview are not working.

Can you help me,please?

Kind Regards,
Raphael.

0
Iva Toteva
Telerik team
answered on 03 Dec 2010, 06:36 PM
Hello Raphael,

Are you getting an exception of some kind or just nothing happens?
You could double-check if all references in your Silverlight project point to the folder with the latest assemblies. The ones you need in order to utilize the printing are:

  • Telerik.Windows.Documents;
  • Telerik.Windows.Documents.FormatProviders.Html.
If you do not find the cause of the problem, would it be possible for you to reproduce the issue in a small demo and send it over in a support ticket?

Kind regards,
Iva
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
RichTextBox
Asked by
Anthony
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
Raphael
Top achievements
Rank 1
Iva Toteva
Telerik team
Share this question
or