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

Losing formatting while the control is in ReadOnly

8 Answers 88 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
ASSYST2 - CGI
Top achievements
Rank 1
ASSYST2 - CGI asked on 24 Feb 2014, 08:44 AM
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.

8 Answers, 1 is accepted

Sort by
0
Missing User
answered on 24 Feb 2014, 04:49 PM
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
0
ASSYST2 - CGI
Top achievements
Rank 1
answered on 25 Feb 2014, 07:06 AM
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.
0
Missing User
answered on 25 Feb 2014, 01:28 PM
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
0
ASSYST2 - CGI
Top achievements
Rank 1
answered on 25 Feb 2014, 01:40 PM
Hi,

I'm already booked for today.
I'll try to do that tomorrow.
0
ASSYST2 - CGI
Top achievements
Rank 1
answered on 10 Mar 2014, 12:24 PM
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.
0
ASSYST2 - CGI
Top achievements
Rank 1
answered on 10 Mar 2014, 12:43 PM
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.
0
Accepted
Missing User
answered on 13 Mar 2014, 10:55 AM
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.

 
0
ASSYST2 - CGI
Top achievements
Rank 1
answered on 17 Mar 2014, 12:58 PM
Thank you very much! Fixed it in no time!
Tags
RichTextBox
Asked by
ASSYST2 - CGI
Top achievements
Rank 1
Answers by
Missing User
ASSYST2 - CGI
Top achievements
Rank 1
Share this question
or