The equation objects in word document are not copied and imported correctly in RadRichTextBox
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();
To reproduce: create a Word document with a table. Design a more complex table with nested tables in each cell. Specify "None" border for the internal tables. When loading the document in the RadRichTextBox, the borders are displayed.
If you export a document using the HtmlFormatProvider, all style properties which contain measurement units are exported in pixel units. This makes the exported documents look much smaller when opened on devices with higher pixel density. WORKAROUND: use Regex to find, convert and replace the font-size attributes HtmlFormatProvider html = new HtmlFormatProvider(); string res = html.Export(document); Regex regex = new Regex(@"font-size: [0-9]*\.?[0-9]*px"); Match match = null; do { match = regex.Match(res); if (!match.Success) { break; } string value = match.Value.Substring("font-size: ".Length, match.Value.Length - "font-size: ".Length - "px".Length); double pts = double.Parse(value) * 72 / 96; res = res.Replace(match.Value, @"font-size: " + Math.Round(pts, 4) + "pt"); } while (match.Success); File.WriteAllText("output.html", res);
To reproduce: radRichTextEditor.Document = new RadDocument(); radRichTextEditor.Document.MeasureAndArrangeInDefaultSize(); radRichTextEditor.UpdateEditorLayout(); radRichTextEditor.Document.CaretPosition.MoveToLastPositionInDocument(); var p = new Paragraph(); p.Inlines.Add(new Span("Cell")); var cell = new TableCell(); cell.Blocks.Add(p); var row = new TableRow(); row.Cells.Add(cell); var table = new Table(); table.Rows.Add(row); var section = new Section(); section.Blocks.Add(table); radRichTextEditor.Document.Sections.Add(section); radRichTextEditor.Document.CaretPosition.MoveToLastPositionInDocument(); var provider = new RtfFormatProvider(); var txt = provider.Export(radRichTextEditor.Document); Clipboard.SetText(txt, TextDataFormat.Rtf); Workaround: measure the document after the section is added: radRichTextEditor.Document.Sections.Add(section); radRichTextEditor.Document.MeasureAndArrangeInDefaultSize(); radRichTextEditor.UpdateEditorLayout();
To reproduce: RadDocument document = new RadDocument(); Section section = new Section(); Paragraph p = new Paragraph(); Span span = new Span(); span.Text ="test" + Environment.NewLine + "test"; ReadOnlyRangeStart rangeStart = new ReadOnlyRangeStart(); ReadOnlyRangeEnd rangeEnd = new ReadOnlyRangeEnd(); rangeEnd.PairWithStart(rangeStart); p.Inlines.Add(rangeStart); p.Inlines.Add(span); p.Inlines.Add(rangeEnd); section.Blocks.Add(p); document.Sections.Add(section); this.radRichTextEditor1.Document = document; Workaround: add an empty span as last inline element in the paragraph: RadDocument document = new RadDocument(); Section section = new Section(); Paragraph p = new Paragraph(); Span span = new Span(); span.Text ="test" + Environment.NewLine + "test"; ReadOnlyRangeStart rangeStart = new ReadOnlyRangeStart(); ReadOnlyRangeEnd rangeEnd = new ReadOnlyRangeEnd(); rangeEnd.PairWithStart(rangeStart); p.Inlines.Add(rangeStart); p.Inlines.Add(span); p.Inlines.Add(rangeEnd); /////////////////////////////////////// Span emptySpan = new Span(); emptySpan.Text = " "; p.Inlines.Add(emptySpan); /////////////////////////////////////// section.Blocks.Add(p); document.Sections.Add(section); this.radRichTextEditor1.Document = document;
1. Open RadRichTexEditor and type the following text: "שדג:3" or open the attached file 2. Save the document as docx file 3. Compare the results in MS Word and in RadRichTexEditor Observed result: in RadRichTexEditor the text is visualized as: ":3שדג" Expected result: The text should be visualized as: "שדג:3"
Workaround: void radRichTextEditor1_CommandExecuting(object sender, CommandExecutingEventArgs e) { if (e.Command is PasteCommand) { e.Cancel = true; PasteNewText(); } } public void PasteNewText() { DocumentFragment clipboardDocument = null; string clipboardText = null; bool clipboardContainsData = false; if (ClipboardEx.ContainsDocument(null)) { clipboardDocument = ClipboardEx.GetDocument(); clipboardContainsData = true; } else if (ClipboardEx.ContainsText(null)) { clipboardText = ClipboardEx.GetText(null); clipboardContainsData = true; } if (!clipboardContainsData) { return; } if (clipboardDocument != null) { RadDocument doc = new RadDocument(); RadDocumentEditor editor = new RadDocumentEditor(doc); editor.InsertFragment(clipboardDocument); TxtFormatProvider provider = new TxtFormatProvider(); string plainText = provider.Export(doc); this.radRichTextEditor1.RichTextBoxElement.ActiveDocumentEditor.Insert(plainText); } else if (!string.IsNullOrEmpty(clipboardText)) { this.radRichTextEditor1.RichTextBoxElement.ActiveDocumentEditor.Insert(clipboardText); } }
Note: this problem is related to the following feedback item: http://feedback.telerik.com/Project/154/Feedback/Details/174882-fix-radrichtexteditor-spellcheckingdialog-should-not-be-closed-when-a-misspell You should apply the suggested workaround in order to be able to replicate the problem. Steps to reproduce: 1. Enter some misspelled words. 2. Open the spell checking form by using the context menu. 3. "Ignore" the first misspelled word. 4. The next wrong word is highlighted. If you add it to the dictionary, the previously ignored word is highlighted as well. Workaround: use the "Ignore All" option.
How to reproduce: public Form1() { InitializeComponent(); richTextEditorRibbonBar1.AssociatedRichTextEditor = radRichTextEditor1; radRichTextEditor1.Insert("This is a example for the \"ContextMenu shows up even when disabled\" error. If you right click on a word nothing happens (just as it is supposed to be) now klick \"Find Next Error\" and there it is (not supposed to be)\n\nlkjds klsdjfio jlk sdjfi lsdifuioew rlsoidf sjdiuf oipds jifpodsuf "); radRichTextEditor1.IsContextMenuEnabled = false; } private void dropdown_PopupOpening(object sender, CancelEventArgs args) { args.Cancel = true; } Workaround: public Form1() { InitializeComponent(); richTextEditorRibbonBar1.AssociatedRichTextEditor = radRichTextEditor1; radRichTextEditor1.Insert("This is a example for the \"ContextMenu shows up even when disabled\" error. If you right click on a word nothing happens (just as it is supposed to be) now klick \"Find Next Error\" and there it is (not supposed to be)\n\nlkjds klsdjfio jlk sdjfi lsdifuioew rlsoidf sjdiuf oipds jifpodsuf "); radRichTextEditor1.IsContextMenuEnabled = false; FieldInfo fi = this.radRichTextEditor1.RichTextBoxElement.ContextMenu.GetType().GetField("radDropDownMenu", BindingFlags.Instance | BindingFlags.NonPublic); RadDropDownMenu dropdown = fi.GetValue(this.radRichTextEditor1.RichTextBoxElement.ContextMenu) as RadDropDownMenu; if (dropdown != null) { dropdown.PopupOpening += dropdown_PopupOpening; } } private void dropdown_PopupOpening(object sender, CancelEventArgs args) { args.Cancel = true; }
To reproduce: - Write some text. - Change the current user. - Repeat three or four times. - Open spellchecking dialog.
Workaround: handle the CommandExecuted event and manually adjust the location of these forms public Form1() { InitializeComponent(); this.radRichTextEditor1.CommandExecuted += radRichTextEditor1_CommandExecuted; } private void radRichTextEditor1_CommandExecuted(object sender, Telerik.WinForms.Documents.RichTextBoxCommands.CommandExecutedEventArgs e) { if (e.Command is ShowInsertSymbolWindowCommand) { ((InsertSymbolDialog)this.radRichTextEditor1.RichTextBoxElement.InsertSymbolWindow).Location = Screen.FromControl(this).WorkingArea.Location; } else if (e.Command is ShowFindReplaceDialogCommand) { ((FindReplaceDialog)this.radRichTextEditor1.RichTextBoxElement.FindReplaceDialog).Location = Screen.FromControl(this).WorkingArea.Location; } }
Workaround: public partial class Form1 : Form { public Form1() { InitializeComponent(); this.AdjustPaddings(0); this.AdjustPaddings(3); } private void AdjustPaddings(int index) { RibbonTab tab = ((RibbonTab)this.richTextEditorRibbonBar1.CommandTabs[0]); RadRibbonBarGroup group = (RadRibbonBarGroup)tab.Items[index]; foreach (RadElement el in group.Items) { el.Padding = new Padding(3, 1, 3, 1); } } }
In some cases where you have RTL word and a number, the word order is different than the order displayed in MS Word (see attached doc). This might be related to the applied styles, because if you apply normal style, the order will be the same as in RadRichTextEditor.
Workaround: set the FormBorderStyle property to FixedSingle for the respective dialog. RadForm f = this.radRichTextEditor1.RichTextBoxElement.FontPropertiesDialog as RadForm; f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
To reproduce: use the following code snippet and refer to the attached screenshot. Cells' width should be identical in both of the cases. RadDocument document = new RadDocument(); Section section = new Section(); Table t = new Table(); t.Borders = new TableBorders(new Border(2, Telerik.WinForms.Documents.Model.BorderStyle.Single, Color.Black)); TableRow r1 = new TableRow(); TableCell cell = new TableCell(); Paragraph p = new Paragraph(); Span s = new Span(); s.Text = "Header"; cell.ColumnSpan = 3; p.Inlines.Add(s); cell.Blocks.Add(p); cell.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 100); r1.Cells.Add(cell); TableRow r2 = new TableRow(); TableCell cell11 = new TableCell(); Paragraph p11 = new Paragraph(); Span s11 = new Span(); s11.Text = "Cell1,1"; p11.Inlines.Add(s11); cell11.Blocks.Add(p11); cell11.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 40); TableCell cell12 = new TableCell(); Paragraph p12 = new Paragraph(); Span s12 = new Span(); s12.Text = "Cell1,2"; p12.Inlines.Add(s12); cell12.Blocks.Add(p12); cell12.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 10); TableCell cell13 = new TableCell(); Paragraph p13 = new Paragraph(); Span s13 = new Span(); s13.Text = "Cell1,3"; p13.Inlines.Add(s13); cell13.Blocks.Add(p13); cell13.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 50); r2.Cells.Add(cell11); r2.Cells.Add(cell12); r2.Cells.Add(cell13); t.Rows.Add(r1); t.Rows.Add(r2); section.Blocks.Add(t); document.Sections.Add(section); this.radRichTextEditor1.Document = document; Workaround: do not specify the PreferredWidth proeprty for cells with ColumnSpan>1
To reproduce: - Set the ParagraphDefaultSpacingAfter to 1. - Start the application and add a comment directly. The issue exist when there is many comments as well. The comment balloons should have minimum size and should not overlap eachother. Workaorund: void radRichTextEditor1_CommandExecuting(object sender, CommandExecutingEventArgs e) { if (e.Command is InsertCommentCommand) { int paragaphs = radRichTextEditor1.Document.Sections.First().Blocks.Count(); if (paragaphs <= 1) { radRichTextEditor1.InsertLineBreak(); } } }
To reproduce: <!DOCTYPE html> <html> <head> <style type="text/css">body { font-family: Segoe UI; } a { color: #5cb85c; } a:hover { color: #000000; }</style> <title>My first HTML document</title> </head> <body> <span style="font-size: 14px; margin-bottom: 5px; display:block;">The Title</span> <ul style="list-style-type:none; padding-left: 0px; margin-left: 0px;"> <li style="margin-left: 0px; padding-left: 0px; font-size: 12px;"> <a href="www.myurl.com">My URL</a> </li> <li style="margin-left: 0px; padding-left: 0px; font-size: 12px;"> <a href="https://www.myurl2.com/">My URL 2</a> </li> </ul> </body> </html>