Bug in MsRichTextBoxXamlFormatProvider

6 posts, 0 answers
  1. Hicham
    Hicham avatar
    6 posts
    Member since:
    Sep 2010

    Posted 16 Aug 2011 Link to this post

    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,

  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 18 Aug 2011 Link to this post

    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 >>

  3. DevCraft banner
  4. David
    David avatar
    1 posts
    Member since:
    Sep 2011

    Posted 03 Nov 2011 Link to this post

    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.




  5. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 08 Nov 2011 Link to this post

    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 >>

  6. vikas
    vikas avatar
    11 posts
    Member since:
    May 2011

    Posted 06 Aug 2014 Link to this post

    Telerik team,
    Can you please confirm if the above issue is fixed. If so, can you please provide a sample code.

    Thanks,
  7. Petya
    Admin
    Petya avatar
    975 posts

    Posted 08 Aug 2014 Link to this post

    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.
     
Back to Top
DevCraft banner