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

Bug in MsRichTextBoxXamlFormatProvider

5 Answers 84 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Hicham
Top achievements
Rank 1
Hicham asked on 16 Aug 2011, 08:57 AM

Hi,

I used the MsRichTextBoxXamlFormatProvider to edit some FlowDocument I have in a database.

While reading seems to be ok, exporting a FlowDocument has a bug : FontWeight information is lost !

After digging in the code using a disassembler, I found the origin of the bug :

You should add :

Inline.FontWeight = span.FontWeight ;

In MsRichTextBoxXamlExporter.CopySpanStyleToInline(Span span, Inline inline).
Regards,

5 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 18 Aug 2011, 09:56 AM
Hello Hicham,

Thank you for reporting this bug  and evening taking the effort to find the origin of the problem.
We will make sure to include the fix in the service pack in mid September.
The Telerik points in your account have been updated as a token of our appreciation.

Regards,
Iva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
David
Top achievements
Rank 1
answered on 03 Nov 2011, 07:26 PM
Hi,

Is this bug fixed?

After upgrading to version 2011.2.920.1040 I still loose the FontWeight.

If the bug is fixed (which should have been since the September version as stated before), could you provide me sample of how to use it?

Here is what I am doing:


XamlFormatProvider
xamlFP = new XamlFormatProvider();

MsRichTextBoxXamlFormatProvider msXamlFP = new MsRichTextBoxXamlFormatProvider();

var doc = xamlFP.Import(this.TelerikXamlNote);

return msXamlFP.Export(doc);


TelerikXamlNote in this case is a string with the content of a RadRichTextBox. It has italic, bold, underline and highlight. In this case, the highlight is lost but that was no surprise since MS RichTextBox does not support background brushes. However, the font weight is lost, and that was not expected.

Thanks for any help.




0
Iva Toteva
Telerik team
answered on 08 Nov 2011, 06:27 PM
Hello David,

Unfortunately, the bug fix was not included in the September version of the controls. We will however make sure to include it in the upcoming Q3 release.
Please accept our apologies for the inconvenience.

Regards,
Iva Toteva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
vikas
Top achievements
Rank 1
answered on 06 Aug 2014, 06:23 AM
Telerik team,
Can you please confirm if the above issue is fixed. If so, can you please provide a sample code.

Thanks,
0
Petya
Telerik team
answered on 08 Aug 2014, 02:42 PM
Hi vikas,

The issue discussed in this topic has been fixed shortly after the last post back in 2011.

When it comes to sample code, I am not sure what exactly you need. This thread discusses export of RadDocument to string which is pretty straigthforward - you just need to create the respective format provider and call its Export() method. In fact, the provider allows you to directly export a RadDocument to FlowDocument or RichTextBox.
MsRichTextBoxXamlFormatProvider provider = new MsRichTextBoxXamlFormatProvider();
 
string content = provider.Export(this.radRichTextBox.Document);
FlowDocument flowDoc = provider.ExportToFlowDocument(this.radRichTextBox.Document);
RichTextBox box = provider.ExportToRichTextBox(this.radRichTextBox.Document);

I hope this helps.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
RichTextBox
Asked by
Hicham
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
David
Top achievements
Rank 1
vikas
Top achievements
Rank 1
Petya
Telerik team
Share this question
or