Losing formatting while the control is in ReadOnly

9 posts, 1 answers
  1. ASSYST2 - CGI
    ASSYST2 - CGI avatar
    12 posts
    Member since:
    Nov 2013

    Posted 24 Feb 2014 Link to this post

    I have a problem with the RadRichTextBox, when the data of the control shouldn't be modified we put the control in ReadOnly, that way they can still copy the content of it.

    But when you copy the data from a control in ReadOnly, it doesnt keep the formating... The formatting of the tables are the worst problem, doesn't keep the fact that it is  table, for him it's just text :(

    We use the Telerik control in a custom control that is presented like this :

    <telerik:HtmlDataProvider x:Name="htmlDataProvider"
                                      RichTextBox="{Binding ElementName=richTextBox}"
                                      Html="{Binding Path=HtmlValue, ElementName=thisUserControl, Mode=TwoWay}">
                <telerik:HtmlDataProvider.FormatProvider>
                    <telerik:HtmlFormatProvider>
                        <telerik:HtmlFormatProvider.ExportSettings>
                            <telerik:HtmlExportSettings DocumentExportLevel="Fragment"
                                                        ExportStyleMetadata="False"
                                                        StyleRepositoryExportMode="DontExportStyles"
                                                        StylesExportMode="Inline"
                                                        ExportFontStylesAsTags="True" />
                        </telerik:HtmlFormatProvider.ExportSettings>
                    </telerik:HtmlFormatProvider>
                </telerik:HtmlDataProvider.FormatProvider>
            </telerik:HtmlDataProvider>
            <telerik:RadRichTextBox x:Name="richTextBox"
                                    DocumentInheritsDefaultStyleSettings="True"
                                    IsReadOnly="{Binding Path=IsReadOnly, ElementName=thisUserControl, Mode=OneWay}"
                                    BorderBrush="Transparent"
                                    Background="Transparent"
                                    AcceptsTab="False" />

    Maybe it's a issue with the HTML Exrport settings we use, if that's the case, tell me which settings we should use.

    Thank you in advance.
  2. Yancho
    Admin
    Yancho avatar
    72 posts

    Posted 24 Feb 2014 Link to this post

    Hi Fabien,

    Thank you for contacting us!

    Indeed, this is a limitation in the Silverlight platform. The only format supported by the Silverlight clipboard is plain text. Telerik RadRichTextBox for Silverlight has its own clipboard which allows copy/pasting of rich text (images, tables, formatted text) but only in the context of the current opened editor or between instances in the same Silverlight application.

    In comparison with Silverlight, the WPF version of the control does not have such limitation and also allows copy/paste of rich text from MS Word, OpenOffice, etc.

    If you have any further questions, do not hesitate to contact us.

    Regards,
    Yancho
    Telerik
  3. DevCraft banner
  4. ASSYST2 - CGI
    ASSYST2 - CGI avatar
    12 posts
    Member since:
    Nov 2013

    Posted 25 Feb 2014 in reply to Yancho Link to this post

    Oups, I posted in the wrong section sorry. We are using RadRichTextBox for WPF.

    The paste from MS Word and others works fine! It's only when when you copy from the control that is in readonly mode. When the controls are not in read only, it works fine.
  5. Yancho
    Admin
    Yancho avatar
    72 posts

    Posted 25 Feb 2014 Link to this post

    Hi Fabien,

    We are unfamiliar of such a strange behavior and could not reproduce it. If the status of RadRichTextBox is set to read only, all of its rich text (images, tables, formatted text) content can be copied with no format loss.

    Could you please try to reproduce the issue in a stand-alone sample? We will greatly appreciate if you can send us such sample as this will be the fastest way for us to investigate the problem and try to provide a solution.

    Thank you in advance! I am looking forward to your reply.

    Regards,
    Yancho
    Telerik
  6. ASSYST2 - CGI
    ASSYST2 - CGI avatar
    12 posts
    Member since:
    Nov 2013

    Posted 25 Feb 2014 Link to this post

    Hi,

    I'm already booked for today.
    I'll try to do that tomorrow.
  7. ASSYST2 - CGI
    ASSYST2 - CGI avatar
    12 posts
    Member since:
    Nov 2013

    Posted 10 Mar 2014 Link to this post

    Sorry for the delay, but I had to take care of some other priorities in this sprint before this problem.

    Anyway, after further investigation while creating a solution to show you the problem, I found out that this problem occurs when the RadRichTextBox is in a custom control and that this control is inside a RadExpander Content.

    I'll post the files after further tests.
  8. ASSYST2 - CGI
    ASSYST2 - CGI avatar
    12 posts
    Member since:
    Nov 2013

    Posted 10 Mar 2014 Link to this post

    This problem seems to occur when the control is in a RadGridView also.

    I didn't recreate this case scenario but I hope this solution will help you understand why this problem happens.

    For a reminder, when I do my tests, I try to copy my selection (part of the textbox) in Microsoft Word 2007, 2010 and Lotus Note.

    You can find the solution here :
    https://www.dropbox.com/s/shrir6og03bdbjs/WPF.ECA.TELERIK.RICHTEXTBOX.zip

    Thank you, best regards.
  9. Answer
    Yancho
    Admin
    Yancho avatar
    72 posts

    Posted 13 Mar 2014 Link to this post

    Hi Fabien,

    Thank you for the follow-up.

    I managed to find out the cause of this strange behavior, it is a missing DLL. I would recommend you to add a reference to Telerik.Windows.Documents.FormatProviders.Rtf.dll and everything should work correctly. The RtfFormatProvider is responsible for copying rich text (images, tables, formatted text) content into the clipboard with no format loss.

    I hope this helps! Let me know how it goes.

    Regards,
    Yancho
    Telerik
     

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

     
  10. ASSYST2 - CGI
    ASSYST2 - CGI avatar
    12 posts
    Member since:
    Nov 2013

    Posted 17 Mar 2014 Link to this post

    Thank you very much! Fixed it in no time!
Back to Top
DevCraft banner