Workaround:
private void RadRichTextEditor1_CommandExecuting(object sender, CommandExecutingEventArgs e)
{
if (!(e.Command is PasteCommand))
{
return;
}
DocumentFragment res = ClipboardEx.GetDocumentFromClipboard("RadDocumentGUID");
if (res == null)
{
foreach (ClipboardHandler settings in ClipboardEx.ClipboardHandlers)
{
res = ClipboardEx.GetDocumentFromClipboard(settings.ClipboardDataFormat, settings.ClipboardStringFilter);
}
}
if (res == null)
{
e.Cancel = true;
System.Drawing.Image bitmapSource = Clipboard.GetImage();
if (bitmapSource == null)
{
return;
}
Telerik.WinForms.Documents.Layout.Padding sectionmargin = this.radRichTextEditor1.Document.CaretPosition.GetCurrentSectionBox().AssociatedSection.ActualPageMargin;
double originalPixelWidth = bitmapSource.Width;
double originalPixelHeight = bitmapSource.Height;
if (originalPixelWidth == 0 || originalPixelHeight == 0)
{
originalPixelWidth = 10;
originalPixelHeight = 10;
}
double width = originalPixelWidth;
double height = originalPixelHeight;
if (this.radRichTextEditor1.Document.LayoutMode == DocumentLayoutMode.Paged)
{
Section currentSection = this.radRichTextEditor1.Document.CaretPosition.GetCurrentSectionBox().AssociatedSection;
Telerik.WinForms.Documents.Model.SizeF pageSize = (Telerik.WinForms.Documents.Model.SizeF)currentSection.GetType().GetProperty("ActualPageSize", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(currentSection);
double maxWidth = pageSize.Width - (sectionmargin.Left + sectionmargin.Right);
double maxHeight = pageSize.Height - (sectionmargin.Top + sectionmargin.Bottom);
width = Math.Min(maxWidth, width);
height = Math.Min(maxHeight, height);
}
double ratio = originalPixelWidth / originalPixelHeight;
width = Math.Min(width, height * ratio);
height = width / ratio;
Telerik.WinControls.RichTextEditor.UI.Size size = new Telerik.WinControls.RichTextEditor.UI.Size(width, height);
ImageInline imageInline = new ImageInline(new WriteableBitmap(bitmapSource));
imageInline.Size = size;
this.radRichTextEditor1.RichTextBoxElement.ActiveDocumentEditor.InsertInline(imageInline);
}
}
Pressing Tab/Shift+Tab when caret position is at the beginning of a paragraph should change current paragraph FirstLineIndent instead of LeftIndent.
First line indent should be changed to Document.DefaultTabWidth step.
Workaround:
private void RadRichTextEditor1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData != Keys.Tab)
{
return;
}
this.radRichTextEditor1.Insert("\t");
e.SuppressKeyPress = true;
e.Handled = true;
}
Implement commands and UI for producing labels using Mail Merge. Behind the scenes this is implemented as Table with the proper number of table columns and rows, and eventually (depending on the setup) NEXT field (https://support.office.com/en-us/article/Field-codes-Next-field-3862fad6-0297-411a-a4e7-6ff5bcf178fd?ui=en-US&rs=en-US&ad=US) - so this will eventually require implementing NEXT field. Note: In MS Word, this is in Mailings -> Start Mail Merge -> Labels...
Add support for All Capitals (All caps) and Small Capitals (Small caps) run property. MS Word has such option in Home -> Font -> Dialog Launcher -> Font -> All Caps/Small Caps. All letters of such runs are visualized as capital letters. The corresponding elements in OOXML are <w:caps /> and <w:smallcaps />.
In certain fonts the caret is drawn on part of the last inputted character
There is an issue with the way the editor decides what width to render a table. The example I have encountered is in an HTML email from Outlook that contained a table. Whatever way Outlook composes the HTML, it adds a width attribute and a style attribute to the table's opening tag: <table width="0" style="width: 500px;"> In this situation, the inline style should take precedence over the width attribute (the width attribute is actually deprecated as of HTML5). This is how all common browsers behave. You can see in the attached 1_browser.png that Chrome correctly renders the table at 500px; However the RadRichtextEditor component incorrectly renders the table at width 0 as shown in attached 2_RadRichtextEditor.png, ignoring the width specified in the style attribute. Curiously, other CSS rules in the style attribute are correctly interpreted. For example: <table width="0" style="width: 500px;font-weight:bold;"> will display a table of zero width with bold text in the RadRichTextEditor. Thanks guys!
How to reproduce: check the attached project and video
Workaround: create a custom RichTextEditorRibbonBar
Public Class CustomRichTextEditorRibbonBar
Inherits RichTextEditorRibbonBar
Protected Overrides Sub HandleFontStylePropertiesOnCurrentEditingStyleChanged()
If Me.dropDownListFont.BindingContext Is Nothing Then
Me.dropDownListFont.BindingContext = Me.BindingContext
End If
If Me.dropDownListFontSize.BindingContext Is Nothing Then
Me.dropDownListFontSize.BindingContext = Me.BindingContext
End If
MyBase.HandleFontStylePropertiesOnCurrentEditingStyleChanged()
End Sub
End Class
To reproduce: - Open the demo application. - Go to the Table Styles example. - Open the TableBorders dialog from the context menu and hit reset all.
Workaround: To clear a given property, basing on some logic which determines if it should be cleared. For example
this.radRichTextEditor1.CommandExecuting += (s, e) =>
{
if (e.Command is ChangeStyleNameCommand)
{
var style = this.radRichTextEditor1.Document.StyleRepository.GetValueOrNull(e.CommandParameter.ToString());
if (style.Type == Telerik.WinForms.Documents.Model.Styles.StyleType.Paragraph)
{
Paragraph paragraph = this.radRichTextEditor1.Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph;
foreach (Span span in paragraph.EnumerateChildrenOfType<Span>())
{
span.ClearValue(Span.FontFamilyProperty);
span.ClearValue(Span.FontSizeProperty);
}
}
}
};