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;
}
}
1. Create a document containing a style with NextStyleName:
StyleDefinition myStyle = new StyleDefinition();
myStyle.Type = StyleType.Table;
myStyle.DisplayName = "My Style";
myStyle.Name = "myStyle";
myStyle.NextStyleName = RadDocumentDefaultStyles.HyperlinkStyleName;
this.radRichTextBox.Document.StyleRepository.Add(myStyle);
2. Add several paragraphs and select some of them (ensure there is one using our custom style).
3. Create a DocumentFragment using the selection's CopySelectedDocumentElements
4. Convert the fragment to RadDocument and try to export it
Observed: When exporting to DOCX and XAML, the style is missing. Exporting to RTF causes KeyNotFoundException.
Expected: The style should be preserved in the exported document
Workaround: After creating the document from the fragment, ensure all needed styles are copied and available.
To reproduce: - Open the demo application. - Go to the Table Styles example. - Open the TableBorders dialog from the context menu and hit reset all.