Please refer to the attached screenshot. It is not possible to localize the marked label.
Workaround:
Sub New()
InitializeComponent()
Me.RadRichTextEditor1.RichTextBoxElement.InsertHyperlinkDialog = New CustomInsertHyperlinkDialog()
End Sub
Public Class CustomInsertHyperlinkDialog
Inherits InsertHyperlinkDialog
Protected Overrides Sub OnLoad(e As EventArgs)
MyBase.OnLoad(e)
Me.Controls("radLabel4").Text = "My address"
End Sub
End Class
Workaround: use a custom RichTextEditorRibbonBar
Public Class CustomRichTextEditorRibbonBar
Inherits RichTextEditorRibbonBar
Dim headerText As String
Protected Overrides Function GetInsertTableItems() As RadItemCollection
Dim collection As RadItemCollection = MyBase.GetInsertTableItems()
Dim headerItem As RadMenuInsertTableItem = TryCast(collection(0), RadMenuInsertTableItem)
headerText = "My Header Text"
Dim fi As FieldInfo = GetType(RadMenuInsertTableItem).GetField("header", BindingFlags.NonPublic Or BindingFlags.Instance)
Dim header As LightVisualElement = fi.GetValue(headerItem)
header.Text = headerText
AddHandler header.TextChanged, AddressOf header_TextChanged
Return collection
End Function
Private Sub header_TextChanged(sender As Object, e As EventArgs)
Dim lve As LightVisualElement = TryCast(sender, LightVisualElement)
If lve.Text = "Insert Table" Then
lve.Text = headerText
End If
End Sub
End Class
Workaround:
private void CopyButton_Click(object sender, EventArgs e)
{
this.radRichTextEditor1.Document.EnsureDocumentMeasuredAndArranged();
if (this.radRichTextEditor1.Document.Selection.IsEmpty)
{
return;
}
string selectedText = this.radRichTextEditor1.Document.Selection.GetSelectedText();
DocumentFragment fragmentToCopy = this.radRichTextEditor1.Document.Selection.CopySelectedDocumentElements(true);
DataObject dataObject = new DataObject();
if (selectedText != "")
{
ClipboardEx.SetText(null, selectedText, dataObject);
}
ClipboardEx.SetDocument(fragmentToCopy, dataObject);
ClipboardEx.SetDataObject(dataObject);
}
To reproduce: please refer to the attached sample project.
Workaround: export RadRichTextEditor's content to a .doc file. Then, use the RadWordsProcessing library to import the .doc file and export it as a pdf:
Telerik.WinForms.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider provider =
new Telerik.WinForms.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
string fileName = @"..\..\exported.doc";
string pdfFileName = @"..\..\exported.pdf";
Stream s = new FileStream(fileName,FileMode.Create, FileAccess.Write);
provider.Export(document, s);
s.Close();
s.Dispose();
Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider2 =
new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
using (Stream input = File.OpenRead(fileName))
{
Telerik.Windows.Documents.Flow.Model.RadFlowDocument document2 = provider2.Import(input);
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider provider3 =
new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
using (Stream output = File.OpenWrite(pdfFileName))
{
provider3.Export(document2, output);
}
}
System.Diagnostics.Process.Start(pdfFileName);
To reproduce:
Seth the default font like this:
radRichTextEditor1.Document.StyleRepository[RadDocumentDefaultStyles.NormalStyleName].SpanProperties.FontFamily = new Telerik.WinControls.RichTextEditor.UI.FontFamily("Segoe Script");
radRichTextEditor1.RichTextBoxElement.ChangeFontFamily(new Telerik.WinControls.RichTextEditor.UI.FontFamily("Segoe Script"));
radRichTextEditor1.RichTextBoxElement.ChangeFontSize(Unit.PointToDip(12));
radRichTextEditor1.RichTextBoxElement.ChangeFontStyle(Telerik.WinControls.RichTextEditor.UI.FontStyles.Italic);
radRichTextEditor1.RichTextBoxElement.ChangeFontWeight(Telerik.WinControls.RichTextEditor.UI.FontWeights.Bold);
Start the application and insert header footer and endnotes.
To reproduce:
private void radButton1_Click(object sender, EventArgs e)
{
var document = new RadDocument();
var section = new Section();
document.Sections.Add(section);
var paragraph = new Paragraph();
section.Blocks.Add(paragraph);
var span = new Span("BOLD");
span.FontWeight = FontWeights.Bold;
paragraph.Inlines.Add(span);
span = new Span(" REGULAR");
paragraph.Inlines.Add(span);
editor.Document = document;
var pdfExporter = new PdfFormatProvider();
var path = Path.GetTempFileName() + ".pdf";
using (var file = File.Create(path))
{
pdfExporter.Export(document, file);
file.Flush();
file.Close();
}
Process.Start(path);
}
Workaround: export .docx file and use the RadWordsProcessing library to import the .doc file and export it to pdf:
private void radButton1_Click(object sender, EventArgs e)
{
var document = new RadDocument();
var section = new Section();
document.Sections.Add(section);
var paragraph = new Paragraph();
section.Blocks.Add(paragraph);
var span = new Span("BOLD");
span.FontWeight = FontWeights.Bold;
paragraph.Inlines.Add(span);
span = new Span(" REGULAR");
paragraph.Inlines.Add(span);
editor.Document = document;
var wordExporter = new Telerik.WinForms.Documents.FormatProviders.OpenXml.Docx.DocxFormatProvider();
var wordPath = Path.GetTempFileName() + ".doc";
using (var file = File.Create(wordPath))
{
wordExporter.Export(document, file);
file.Flush();
file.Close();
}
Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider =
new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
using (Stream input = File.OpenRead(wordPath))
{
Telerik.Windows.Documents.Flow.Model.RadFlowDocument doc = provider.Import(input);
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider pdfProvider =
new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
string filePath = @"..\..\" + DateTime.Now.ToLongTimeString().Replace(":", "-");
using (var output = File.Create(filePath))
{
pdfProvider.Export(doc, output);
}
Process.Start(filePath);
}
}
When the specified length of the stream is larger than the actual one, Adobe throws errors and removes the image. Workaround: Set the format provider settings: PdfFormatProvider provider = new PdfFormatProvider(); PdfExportSettings exportSettings = new PdfExportSettings(); exportSettings.ContentsDeflaterCompressionLevel = 9; exportSettings.ImagesDeflaterCompressionLevel = 9; provider.ExportSettings = exportSettings;
To reproduce: 1. Insert a table 2. Select all cells in it 3. Press the Backspace key => the table is removed but the table adorner is still visible The adorner disappears if clicked
To reproduce: - Add some misspelled words. - Enable the spell check - the layout is updated and the words are underlined. - Disable the spell check - the lines are not removed until one clicks in the RichTextEditor. Workaround: radRichTextEditor1.IsSpellCheckingEnabled = !radRichTextEditor1.IsSpellCheckingEnabled; radRichTextEditor1.Document.LayoutMode = DocumentLayoutMode.Paged; radRichTextEditor1.Document.LayoutMode = DocumentLayoutMode.Flow;
html tables cannot be properly pasted in word when imported table size is defined in "pt". consider adding the a table like this as well: <html> <body> <table border="1"> <tbody> <tr> <td>A</td> <td>B</td> <td>C</td> </tr> <tr> <td>A1</td> <td>B1</td> <td>C1</td> </tr> </tbody> </table> </body> </html>
To reproduce: - Paste some text with a barcode font in a RadRichTextBox. - Export to a pdf document. - In the pdf document the text is not displayed as barcode.
Workaround:
string styleSuffix = "_1";
foreach (var importedStyle in rtfDoc.StyleRepository)
{
importedStyle.Name = string.Concat(importedStyle.Name, styleSuffix);
}
Invisible borders in html format are imported as black borders in RadRichTextBox Resolution: This issue is addressed in the new version of the control - RadRichTextEditor. Please use the new control instead the RadRichTextBox.
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:
- Copy the content from the attached document - do not copy the last row.
- Remove the bookmarks like this:
bookmarks = radRichTextEditor1.Document.GetAllBookmarks().ToArray();
foreach (BookmarkRangeStart item in bookmarks)
{
radRichTextEditor1.Document.GoToBookmark(item);
radRichTextEditor1.DocumentEditor.DeleteBookmark(item);
}
Workaround:
var invalidStarts = this.radRichTextBox.Document
.EnumerateChildrenOfType<BookmarkRangeStart>()
.Where(start => start.End == null)
.ToList();
foreach (var invalidStart in invalidStarts)
{
invalidStart.Parent.Children.Remove(invalidStart);
}
Note that when this workaround is used the document history will be deleted as well, which means that the undo operation will no longer hold information for previous operations
Workaround:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.radRichTextEditor1.IsSpellCheckingEnabled = true;
this.radRichTextEditor1.Insert("SOooome wrrrrong wooooooooords.");
this.radRichTextEditor1.CommandExecuted += radRichTextEditor1_CommandExecuted;
}
bool shouldProcess = true;
private void radRichTextEditor1_CommandExecuted(object sender, Telerik.WinForms.Documents.RichTextBoxCommands.CommandExecutedEventArgs e)
{
if (e.Command is DeleteCommand)
{
if (shouldProcess)
{
shouldProcess = false;
RichTextEditorInputBehavior behavior = this.radRichTextEditor1.InputHandler;
behavior.ProcessKeyDown(new KeyEventArgs(Keys.Back));
}
shouldProcess = true;
}
}
}