Hello,
Is there a way to inherit the current font settings when pasting text into a RadRichTextBox that was copied from another RadRichTextBox?
If the destination has the text "original text" with Arial font and the source has the text "testing" with no font specified, copying and pasting after "original" should show "original testing text" with Arial font.
The following is what I'm trying:
XAML:
Code Behind:
The output shows the following:
This causes testing to still be "inherited" since it is not inserted as a child of the span with "Original". Is there any way I can do this or do I need to take over the Paste logic?
Thanks,
Wil
Is there a way to inherit the current font settings when pasting text into a RadRichTextBox that was copied from another RadRichTextBox?
If the destination has the text "original text" with Arial font and the source has the text "testing" with no font specified, copying and pasting after "original" should show "original testing text" with Arial font.
The following is what I'm trying:
XAML:
<t:RadRichTextBox Name="txt" Grid.Row="1" FontFamily="inherited" DocumentInheritsDefaultStyleSettings="True"/>
<TextBox Name="html" Grid.Row="2" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"/>Code Behind:
01.public MainWindow()02.{03. InitializeComponent();04. 05. txt.ChangeParagraphSpacingAfter(0);06. txt.DocumentContentChanged += TxtOnDocumentContentChanged;07.}08. 09.private void TxtOnDocumentContentChanged(object sender, EventArgs eventArgs)10.{11. UpdateHtml();12.}13. 14.private void UpdateHtml()15.{16. var settings = new HtmlExportSettings();17. settings.DocumentExportLevel = DocumentExportLevel.Fragment;18. settings.ExportStyleMetadata = false;19. settings.StylesExportMode = StylesExportMode.Inline;20. 21. var converter = new HtmlFormatProvider();22. converter.ExportSettings = settings;23. html.Text = converter.Export(txt.Document);24.}The output shows the following:
<p class="Normal "><span style="font-family: 'Arial';">Original </span>testing<span style="font-family: 'Arial';"> text</span></p>This causes testing to still be "inherited" since it is not inserted as a child of the span with "Original". Is there any way I can do this or do I need to take over the Paste logic?
Thanks,
Wil