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.
How to reproduce: 1. Run the Mail Merge example (QSF) 2. Select the image inside the document and move it to another position
Use the code below.
1. Click the first button to insert a link.
2. Click inside the link to move the cursor.
3. Click the second button to insert the yellow rectangle
4. Click the third button to export the HTML content.
Actual result: StackOverflow exception occurs
private void radButton1_Click(object sender, EventArgs e)
{
HyperlinkInfo info = new HyperlinkInfo()
{
NavigateUri = "http://www.google.com",
Target = HyperlinkTargets.Blank,
IsAnchor = false
};
this.radRichTextEditor1.InsertHyperlink(info, "www.google.com");
}
private void radButton2_Click(object sender, EventArgs e)
{
LightVisualElement button = new LightVisualElement();
button.Text = "My Button";
button.DrawFill = true;
button.BackColor = System.Drawing.Color.Yellow;
button.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
Section section = new Section();
Paragraph paragraph = new Paragraph();
InlineUIContainer container = new InlineUIContainer();
RadElementUIContainer radContainer = new RadElementUIContainer(button);
container.UiElement = radContainer;
container.Height = 25;
container.Width = 70;
paragraph.Inlines.Add(container);
section.Blocks.Add(paragraph);
RadDocument doc = new RadDocument();
doc.Sections.Add(section);
radRichTextEditor1.InsertFragment(new DocumentFragment(doc));
}
private void radButton3_Click(object sender, EventArgs e)
{
Telerik.WinForms.Documents.Model.RadDocument document = radRichTextEditor1.Document;
Telerik.WinForms.Documents.FormatProviders.Html.HtmlFormatProvider provider = new Telerik.WinForms.Documents.FormatProviders.Html.HtmlFormatProvider();
provider.ExportSettings.InlineUIContainerExporting += ExportSettings_InlineUIContainerExporting;
provider.ExportSettings.DocumentExportLevel = Telerik.WinForms.Documents.FormatProviders.Html.DocumentExportLevel.Fragment;
provider.ExportSettings.ExportFontStylesAsTags = true;
provider.ExportSettings.SpanExportMode = Telerik.WinForms.Documents.FormatProviders.Html.SpanExportMode.DefaultBehavior;
string htmlValue = provider.Export(document);
webBrowser1.DocumentText = htmlValue;
}
private void ExportSettings_InlineUIContainerExporting(object sender, Telerik.WinForms.Documents.FormatProviders.Html.InlineUIContainerExportingEventArgs e)
{
}
Import the following code: <ol> <li>Coffee</li> <li></li> <li>Milk</li> </ol
To reproduce: - insert a fragmet from another RichtextEditor like this: private void Button_Click(object sender, RoutedEventArgs e) { radRichTextBox.Document.Sections.Clear(); radRichTextBox.Document.Sections.Add(new Section()); radRichTextBox.Document.CaretPosition.MoveToLastPositionInDocument(); radRichTextBox.DocumentEditor.InsertParagraph(); radRichTextBox.DocumentEditor.InsertFragment(new DocumentFragment(radRichTextEditor1.Document)); radRichTextBox.DocumentEditor.InsertParagraph(); } Workaround: There is no point of resetting the section in such way. Nevertheless, you can avoid the exception by using one of the following methods: radRichTextBox.Document.MeasureAndArrangeInDefaultSize(); radRichTextBox.UpdateEditorLayout();
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(); } }
Workaround: public class MyInputBehavior : InputBehavior { public MyInputBehavior(DocumentView view) : base(view) { } public override bool ProcessKeyPress(System.Windows.Forms.KeyPressEventArgs e) { // TO DO: You code here e.KeyChar = char.ToUpper(e.KeyChar); return true; // By commenting the base call you are supresing the default logic //return base.ProcessKeyPress(e); } } Then you should replace the default input behavior by using the following code snippet: this.richTextBox.DocumentView.InputBehavior = new MyInputBehavior(this.richTextBox.DocumentView);
RadRichTextBox large txt documents (20000 rows)are loaded very slowly.
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.
The HtmlFormatProvider does not import correctly html content of div tags and css styles.
To reproduce: string text = "<p style=\"font-family:Calibri; font-size:15pt;\">Hi,<br/><br/><br/><br/>Regards<br/></p>"; HtmlFormatProvider provider = new HtmlFormatProvider(); RadDocument document = new RadDocument(); document = provider.Import(text); radRichTextBox1.Document = document; Click on an empty line and you will see that the font is different.
How to reproduce: private void radButton1_Click(object sender, EventArgs e) { RadPrintDocument doc = new RadPrintDocument(); doc.Margins = new Margins(0, 0, 10, 10); doc.AssociatedObject = this.radRichTextEditor1; RadPrintPreviewDialog dialog = new RadPrintPreviewDialog(); dialog.Document = doc; dialog.ShowDialog(); } Workaround: apply the margins on the document loaded in the editor private void radButton1_Click(object sender, EventArgs e) { RadPrintDocument doc = new RadPrintDocument(); this.radRichTextEditor1.Document.SectionDefaultPageMargin = new Telerik.WinForms.Documents.Layout.Padding(0, 0, 10, 10); doc.AssociatedObject = this.radRichTextEditor1; RadPrintPreviewDialog dialog = new RadPrintPreviewDialog(); dialog.Document = doc; dialog.ShowDialog(); }
To reproduce: - Add some full pages to the editor. - Remove all margin from the print settings and document settings. - PrintPreview the document. - Seth the print preview dialog zoom to 100% and compare the documents. - You will notice that the print document's content is smaller.