ADD. RadRichTextBox - import text boxes from docx files
Currently it is not possible to control the HTML exported from RadRichTextBox and strip styles or embed them.
Currently this product cannot read the text contained in RichTextBox.
The bullets can have their own alignment. Implement import and export of this setting. In MS Word, this alignment can be set through the Numbering dropdown -> Define New Number Format
When a table cell contains nested table, and the paragraph after the nested table is empty, this paragraph could be collapsed, as in MS Word. This gives better look to nested tables, similar to how browsers visualize nested HTML tables. Note that the paragraph should be visualized when the caret moves the position inside the paragraph. Currently the paragraph is visualized with its full height, making the layout different than MS Word - it appears that there are redundant space after the nested table.
To reproduce: try to hide the caret: this.radRichTextEditor1.CaretWidth = 0; Workaround: //Flow layout this.radRichTextEditor1.LayoutMode = DocumentLayoutMode.Flow; Telerik.WinControls.RichTextEditor.UI.DocumentWebLayoutPresenter webLayoutPresenter = this.radRichTextEditor1.RichTextBoxElement.ActiveEditorPresenter as Telerik.WinControls.RichTextEditor.UI.DocumentWebLayoutPresenter; webLayoutPresenter.Caret.Width = 0; //Page layout this.radRichTextEditor1.LayoutMode = DocumentLayoutMode.Paged; Telerik.WinControls.RichTextEditor.UI.DocumentPrintLayoutPresenter activeEditorPresenter1 = this.radRichTextEditor1.RichTextBoxElement.ActiveEditorPresenter as DocumentPrintLayoutPresenter; activeEditorPresenter1.Caret.Width = 0;
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 a word, press tab the add another word. - Export the document using HtmlFormatProvider. - Import the same document. - The tab is interpreted like 7 spaces.
To reproduce: - Click the InsertMergeFiled button before setting the data source. - Set the data source. - Click the button again. - There are no items in it. Workaround: Friend Class MyRichTextEditorRibbonBar Inherits RichTextEditorRibbonBar Protected Overrides Sub dropDownButtonInsertMergeField_DropDownOpening(sender As Object, e As CancelEventArgs) MyBase.dropDownButtonInsertMergeField_DropDownOpening(sender, e) If Me.dropDownButtonInsertMergeField.Items.Count = 0 Then Me.dropDownButtonInsertMergeField.Items.Add(New RadItem) End If End Sub End Class
To reproduce: please refer to the attached gif file Add a custom tab in the ribbon UI and a RadDropDownListElement bound to a list of strings. The first item is selected by default. Insert a table by using the ribbon UI and try to get programmatically the RadDropDownListElement.SelectedValue/Index. It is null/-1 although the text is correct. Workaround: public class CustomRichTextEditorRibbonBar : RichTextEditorRibbonBar { protected override void CreateChildItems(RadElement parent) { base.CreateChildItems(parent); FieldInfo fi = typeof(RadRibbonBar).GetField("ribbonBarElement", BindingFlags.Instance | BindingFlags.NonPublic); RadRibbonBarElement ribbonBarElement = fi.GetValue(this) as RadRibbonBarElement; ribbonBarElement = new CustomRadRibbonBarElement(); fi.SetValue(this, ribbonBarElement); this.RootElement.Children.Add(ribbonBarElement); ribbonBarElement.CommandTabSelecting += delegate (object sender, CommandTabSelectingEventArgs args) { OnCommandTabSelecting(args); }; ribbonBarElement.CommandTabSelected += delegate (object sender, CommandTabEventArgs args) { OnCommandTabSelected(args); }; ribbonBarElement.ExpandedStateChanged += delegate (object sender, EventArgs args) { this.OnRibbonBarExpandedStateChanged(args); }; } } public class CustomRadRibbonBarElement : RadRibbonBarElement { protected override float GetMaximumTabContentHeight() { return 104; } }
How to reproduce: create a document like the one below, then try to add a comment for an element in the paragraph with the bookmarks Public Class Form2 Sub New() InitializeComponent() Dim document As New RadDocument() Dim section As New Section() Dim paragraph As New Paragraph() Dim span As New Span("Content prior range[") Dim span2 As New Span("]Content after range") Dim readOnlyContent As New Span("READ ONLY") Dim rangeStart As New ReadOnlyRangeStart() Dim rangeEnd As New ReadOnlyRangeEnd() rangeEnd.PairWithStart(rangeStart) paragraph.Inlines.Add(span) paragraph.Inlines.Add(rangeStart) paragraph.Inlines.Add(readOnlyContent) paragraph.Inlines.Add(rangeEnd) paragraph.Inlines.Add(span2) section.Blocks.Add(paragraph) document.Sections.Add(section) Dim bmSection As New Section() Dim bmParagraph As New Paragraph() Dim bmSpan As New Span("Content prior bookmark[") Dim bmSpan2 As New Span("]Content after bookmark") Dim bmContent As New Span("Content in Bookmark") Dim bmRangeEnd As New BookmarkRangeEnd() Dim bmRangeStart = DirectCast(bmRangeEnd.CreatePairedStart(), BookmarkRangeStart) bmRangeStart.Name = System.Guid.NewGuid().ToString() bmParagraph.Inlines.Add(bmSpan) bmParagraph.Inlines.Add(bmRangeStart) bmParagraph.Inlines.Add(bmContent) bmParagraph.Inlines.Add(bmRangeEnd) bmParagraph.Inlines.Add(bmSpan2) bmSection.Blocks.Add(bmParagraph) document.Sections.Add(bmSection) Me.RadRichTextEditor1.Document = document End Sub End Class
To reproduce: add some text to RadRichTextEditor and set the Enabled property to false. You will notice that the text gets bold and blurry. Workaround: instead of disabling RadRichTextEditor, use the ReadOnly property.
Steps to reproduce: 1. Use the following code snippet: public partial class Form1 : RadForm { public Form1() { InitializeComponent(); this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.radRichTextEditor1.Document = ImportDocx(@"..\..\lorem.docx"); this.radRichTextEditor1.LayoutMode = DocumentLayoutMode.Paged; this.radRichTextEditor1.ChangeSectionPageSize(PaperTypeConverter.ToSize(PaperTypes.A3)); this.radRichTextEditor1.ChangeSectionPageOrientation(PageOrientation.Landscape); } private void radButton1_Click_1(object sender, EventArgs e) { this.radRichTextEditor1.PrintPreview(); } private void radButton3_Click(object sender, EventArgs e) { this.radRichTextEditor1.Print(true); } } Calling the PrintPreview method, the page orientation is updated in PrintSettingDialog. However, the page size is not updated correctly. As result, the printed document is not correct. If you call the Print method, the page size and orientation are not updated and the document is printed as in A4/Portrait instead A3/Landscape. Workaround: Use RadPrintDocument: private void radButton2_Click(object sender, EventArgs e) { RadPrintDocument radPrintDocument1 = new RadPrintDocument(); radPrintDocument1.AssociatedObject = this.radRichTextEditor1; radPrintDocument1.Landscape = true; PaperSize ps = new PaperSize(); ps.RawKind = (int)PaperKind.A3; radPrintDocument1.DefaultPageSettings.PaperSize = ps; radPrintDocument1.Print(); //this.radRichTextEditor1.Print(true, radPrintDocument1); }
Workaround: private void ClearDictionaries(RadRichTextEditor editor) { var dictionaries = typeof(DocumentSpellChecker).GetField("dictionaries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(editor.SpellChecker) as Dictionary<CultureInfo, Lazy<IWordDictionary>>; dictionaries.Clear(); var customDictionaries = typeof(DocumentSpellChecker).GetField("customDictionaries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(editor.SpellChecker) as Dictionary<CultureInfo, ICustomWordDictionary>; customDictionaries.Clear(); }
To reproduce: - Add some comments and try to navigate through them. - Try add or show/hide the comments while the cursor is in one of the comments. Workaround: Create a custom RichTextEditorRibbonBar and override the following methods: Public Class MyRichTextEditorRibbonBar Inherits RichTextEditorRibbonBar Protected Overrides Sub ButtonNewComment_Click(sender As Object, e As EventArgs) Dim command As New InsertCommentCommand(Me.AssociatedRichTextEditor.RichTextBoxElement) Me.ExecuteCommand(command) End Sub Protected Overrides Sub ButtonDeleteComment_Click(sender As Object, e As EventArgs) Dim command As New DeleteCommentCommand(Me.AssociatedRichTextEditor.RichTextBoxElement) Me.ExecuteCommand(command) End Sub Protected Overrides Sub ButtonPreviousComment_Click(sender As Object, e As EventArgs) Dim command As New GoToPreviousCommentCommand(Me.AssociatedRichTextEditor.RichTextBoxElement) Me.ExecuteCommand(command) End Sub Protected Overrides Sub ButtonNextComment_Click(sender As Object, e As EventArgs) Dim command As New GoToNextCommentCommand(Me.AssociatedRichTextEditor.RichTextBoxElement) Me.ExecuteCommand(command) End Sub Protected Overrides Sub ToggleButtonShowHideComments_ToggleStateChanged(sender As Object, args As StateChangedEventArgs) Dim command As New ToggleCommentsCommand(Me.AssociatedRichTextEditor.RichTextBoxElement) Me.ExecuteCommand(command) End Sub Protected Overrides Sub ButtonDeleteAllComments_Click(sender As Object, e As EventArgs) Dim command As New DeleteAllCommentsCommand(Me.AssociatedRichTextEditor.RichTextBoxElement) Me.ExecuteCommand(command) End Sub Protected Overrides Sub HandleDocumentCommandExecuted(document As RadDocument) MyBase.HandleDocumentCommandExecuted(document) Dim hasComments As Boolean = Me.AssociatedRichTextEditor.Document.EnumerateChildrenOfType(Of CommentRangeStart)().Count() > 0 Me.buttonPreviousComment.Enabled = hasComments Me.buttonNextComment.Enabled = hasComments Me.buttonDeleteComment.Enabled = hasComments Me.buttonDeleteAllComments.Enabled = hasComments End Sub End Class