When exporting to HTML, each two consequent spaces in a run are treated as . However, when a style is applied to one of the spaces, the span is split and the two spaces are not considered as a pair, therefore, the HtmlFormatProvider exports them as normal spaces. When the two spaces are the whole content of a paragraph, this paragraph is not visible when the HTML is visualized in a browser.
To reproduce:
1. Add a RichTextEditorRibbonBar on the form
2. Add a RadRichTextEditor on the form.
3. Set the RichTextEditorRibbonBar.AssociatedRichTextEditor property.
4. Run the application. You will notice that the caret for the RadRichTextEditor is displayed and the user expects to start entering text when pressing the keyboard. However, the focused control in this case is the font family drop-down and it accepts the input.
Workaround: focus the RadRichTextEditor in the Form.Shown event:
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
Me.RadRichTextEditor1.Focus()
End Sub
To reproduce:
Please refer to the attached sample application and video demonstrating the experience issue.
Workaround:
Set RadRichTextEditor to null in Form`s Dispose method:
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Me.RadRichTextEditor1 = Nothing
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
Currently all tables are stuck to the let and there cannot be a text before them.
To reproduce: - Create a document that contains a numbered list (set different font size for the list). - Export it to html and import it back. - You will notice that the numbers are larger the the other text.
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;