Please refer to the attached files.
The "Style" gallery is reinitialized each time the AssociatedRichTextEditor is changed.
To reproduce: - Associate the ribbon with the RichtextEditor - Subscribe to the DocumentContentChanged and start the application. - The event is fired because the ribbon is making changes to the document. Workaround: void Form1_Shown(object sender, EventArgs e) { ribbonBar1.AssociatedRichTextEditor = radRichTextEditor1; }
RadRichTextEditor renders the text with a little bigger characters spacing than RadRichTextBox and MS Word.
Note: this text spacing problem can be observed in other Telerik controls as well.
To reproduce: - Add RichTextEditorRuler and RichTextEditor to a form. - Add some tab stops in the ruler and press the tab key. Workaround: void radRichTextEditor1_CommandExecuting(object sender, Telerik.WinForms.Documents.RichTextBoxCommands.CommandExecutingEventArgs e) { if (e.Command is IncrementParagraphLeftIndentCommand) { e.Cancel = true; TabForwardCommand tabForward = new TabForwardCommand(this.radRichTextEditor1.RichTextBoxElement); tabForward.Execute(); } }
To reproduce: - Add several RadRichTextEditors to a form. - Change the icon of the FontPropertiesDialog. - Close the form and force the garbage collector. Workaround: protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); foreach (var item in this.Controls) { var rte = item as RadRichTextEditor; if (rte != null) { ((FontPropertiesDialog)rte.RichTextBoxElement.FontPropertiesDialog).Dispose(); } } }
To reproduce: - Add some text so the scrollbars appear. - Scroll up and down with the mouse wheel. - When you scroll to the bottom you will notice that there is extra space after the document end. Workaround: http://www.telerik.com/forums/backspace-key-does-not-properly-invalidate-editor#sP5qkJX4b0S8jwZ3MUGTmQ
To reproduce: - Add RadRichtextEditor to a form and assosite it with RichTextEditorRibbonBar - Start the application - You will notice that the font is Agency FB. - If you click in the editor the font will change. Workaround: void Form1_Shown(object sender, EventArgs e) { radRichTextEditor1.Focus(); ribbonBar1.GetType().GetMethod("HandleFontStylePropertiesOnCurrentEditingStyleChanged", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(ribbonBar1,null); }
Workaround: load an empty docx document in the RadRichTextEditor and use it as a template public RadDocument ImportDocx() { RadDocument document = null; IDocumentFormatProvider provider = new DocxFormatProvider(); OpenFileDialog openDialog = new OpenFileDialog(); openDialog.Filter = "Documents|*.docx"; openDialog.Multiselect = false; DialogResult dialogResult = openDialog.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { using (Stream stream = openDialog.OpenFile()) { document = provider.Import(stream); } } return document; }
To reproduce: - Add two tabs in a PageView - Add RadRichTextEditor in the second tab - Select some text to show the mini toolbar - Select the first page. Workaround void radPageView1_SelectedPageChanged(object sender, EventArgs e) { if (radPageViewPage2.IsContentVisible == false) { radRichTextEditor1.RichTextBoxElement.SelectionMiniToolBar.Hide(); } }
How to reproduce: public partial class Form1 : Form { RadRichTextBox tb1; RadRichTextBox tb2; private bool shouldFocus = false; public Form1() { InitializeComponent(); tb1 = new RadRichTextBox(); this.Controls.Add(tb1); tb2 = new RadRichTextBox(); tb2.Location = new Point(200, 0); this.Controls.Add(tb2); this.Load += Form1_Load; } private void Form1_Load(object sender, EventArgs e) { StyleDefinition style = new StyleDefinition(); tb1.IsReadOnly = true; tb1.Document.Insert("text 1", style); tb2.Document.Insert("text 2", style); tb2.IsReadOnly = true; } private void radButton1_Click(object sender, EventArgs e) { tb1.IsReadOnly = false; tb2.IsReadOnly = false; tb1.Focus(); } } Workaround: public partial class Form1 : Form { RadRichTextBox tb1; RadRichTextBox tb2; private bool shouldFocus = false; public Form1() { InitializeComponent(); tb1 = new RadRichTextBox(); tb1.GotFocus += tb1_GotFocus; tb1.LostFocus += tb1_LostFocus; this.Controls.Add(tb1); tb2 = new RadRichTextBox(); tb2.Location = new Point(200, 0); tb2.GotFocus += tb2_GotFocus; tb2.LostFocus += tb2_LostFocus; this.Controls.Add(tb2); this.Load += Form1_Load; } private void tb2_LostFocus(object sender, EventArgs e) { shouldFocus = false; tb2.IsReadOnly = true; } private void tb2_GotFocus(object sender, EventArgs e) { if (shouldFocus) { tb2.IsReadOnly = false; } } private void tb1_LostFocus(object sender, EventArgs e) { tb1.IsReadOnly = true; } private void tb1_GotFocus(object sender, EventArgs e) { if (shouldFocus) { tb1.IsReadOnly = false; } } private void Form1_Load(object sender, EventArgs e) { StyleDefinition style = new StyleDefinition(); tb1.IsReadOnly = true; tb1.Document.Insert("text 1", style); tb2.Document.Insert("text 2", style); tb2.IsReadOnly = true; } private void radButton1_Click(object sender, EventArgs e) { if (shouldFocus) { tb2.Focus(); } else { shouldFocus = true; tb1.Focus(); } } }
When the RadRichTExtEditor.Document is rapidly changed not all memory is released Workaround: Point loc = radRichTextEditor1.Location; Size size = radRichTextEditor1.Size; radRichTextEditor1.Dispose(); radRichTextEditor1 = new RadRichTextEditor(); radRichTextEditor1.Location = loc; radRichTextEditor1.Size = size; this.Controls.Add(radRichTextEditor1);
To reproduce: - Add comment and try to select the text with the mouse. Workaround: use keyboard to select the desired text
Workaround: explicitly set the font size of the spans in the heading paragraphs foreach (Section section in this.radRichTextEditor1.Document.Sections) { foreach (Block block in section.Blocks) { Paragraph p = block as Paragraph; if (p != null && p.StyleName == "Heading1") { foreach (var item in p.Inlines) { Span s = item as Span; if (s!= null) { s.FontSize = p.FontSize; } } } } }
The LocalizeStrings method of the FloatingBlockPropertiesDialog refers to the "Documents_FindReplaceDialog_ReplaceWith" string. This should be "Documents_FloatingBlockPropertiesDialog_TextWrapping" Workaround: public Form1() { InitializeComponent(); FieldInfo fi = this.radRichTextEditor1.RichTextBoxElement.FloatingBlockPropertiesDialog.GetType().GetField("radPageViewPage2", BindingFlags.NonPublic | BindingFlags.Instance); RadPageViewPage textWrappingPage = (RadPageViewPage)fi.GetValue(this.radRichTextEditor1.RichTextBoxElement.FloatingBlockPropertiesDialog); textWrappingPage.Text = "TextWrapping"; }
To reproduce: Add image like this: void button_Click1(object sender, EventArgs e) { Section section = new Section(); Paragraph paragraph = new Paragraph(); ImageInline image; Telerik.WinControls.RichTextEditor.UI.Size size = new Telerik.WinControls.RichTextEditor.UI.Size(236, 50); using (MemoryStream ms = new MemoryStream()) { System.Drawing.Image.FromFile(@"C:\img\delete.png").Save(ms, System.Drawing.Imaging.ImageFormat.Png); image = new ImageInline(ms, size, "png"); } paragraph.Inlines.Add(image); section.Children.Add(paragraph); this.radRichTextEditor1.Document.Sections.Add(section); } Workaround: Manually update the layout: this.radRichTextEditor1.UpdateEditorLayout();