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
1. Open RadRichTexEditor and type the following text: "שדג:3" or open the attached file 2. Save the document as docx file 3. Compare the results in MS Word and in RadRichTexEditor Observed result: in RadRichTexEditor the text is visualized as: ":3שדג" Expected result: The text should be visualized as: "שדג:3"
To reproduce:
radRichTextEditor.Document = new RadDocument();
radRichTextEditor.Document.MeasureAndArrangeInDefaultSize();
radRichTextEditor.UpdateEditorLayout();
radRichTextEditor.Document.CaretPosition.MoveToLastPositionInDocument();
var p = new Paragraph();
p.Inlines.Add(new Span("Cell"));
var cell = new TableCell();
cell.Blocks.Add(p);
var row = new TableRow();
row.Cells.Add(cell);
var table = new Table();
table.Rows.Add(row);
var section = new Section();
section.Blocks.Add(table);
radRichTextEditor.Document.Sections.Add(section);
radRichTextEditor.Document.CaretPosition.MoveToLastPositionInDocument();
var provider = new RtfFormatProvider();
var txt = provider.Export(radRichTextEditor.Document);
Clipboard.SetText(txt, TextDataFormat.Rtf);
Workaround: measure the document after the section is added:
radRichTextEditor.Document.Sections.Add(section);
radRichTextEditor.Document.MeasureAndArrangeInDefaultSize();
radRichTextEditor.UpdateEditorLayout();
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: 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);
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
Currently all tables are stuck to the let and there cannot be a text before them.
To reproduce: - Click the AA Styles button to open the Styles dialog. - Scroll down and select the CodeBlock item - The style does not change
Workaround:
public class CustomRadRichTextEditor : RadRichTextEditor
{
/// <summary>
/// Gets or sets the width of the caret.
/// </summary>
[Browsable(false)]
[Category(RadDesignCategory.AppearanceCategory)]
public new float CaretWidth
{
get
{
float caretWidth = base.CaretWidth;
if (float.IsNaN(caretWidth))
{
return 2;
}
return caretWidth;
}
set
{
base.CaretWidth = value;
}
}
}
how to reproduce: check the attached video
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
How to reproduce: check the attached video
To reproduce:
- Add a table where the width is set to 100%
- Import the table and the export it:
private void radButton_Click(object sender, RoutedEventArgs e)
{
var provider = new HtmlFormatProvider();
string text = File.ReadAllText(@"..\..\default.html");
rtb1.Document = provider.Import(text);
}
private void radButton1_Click(object sender, RoutedEventArgs e)
{
var provider = new HtmlFormatProvider();
provider.ExportSettings.StylesExportMode = StylesExportMode.Inline;
string content = provider.Export(rtb1.Document);
File.WriteAllText(@"D:\test1.html", content);
}
Workaround:
Leave the export mode intact.
Workaround: Set the next style property for all types except the Paragraph to an empty string
foreach (var style in this.radRichTextBox.Document.StyleRepository)
{
if (style.Type!=Telerik.Windows.Documents.Model.Styles.StyleType.Paragraph && !string.IsNullOrEmpty(style.NextStyleName))
{
style.NextStyleName = string.Empty;
}
}