There is an issue with the way the editor decides what width to render a table. The example I have encountered is in an HTML email from Outlook that contained a table. Whatever way Outlook composes the HTML, it adds a width attribute and a style attribute to the table's opening tag: <table width="0" style="width: 500px;"> In this situation, the inline style should take precedence over the width attribute (the width attribute is actually deprecated as of HTML5). This is how all common browsers behave. You can see in the attached 1_browser.png that Chrome correctly renders the table at 500px; However the RadRichtextEditor component incorrectly renders the table at width 0 as shown in attached 2_RadRichtextEditor.png, ignoring the width specified in the style attribute. Curiously, other CSS rules in the style attribute are correctly interpreted. For example: <table width="0" style="width: 500px;font-weight:bold;"> will display a table of zero width with bold text in the RadRichTextEditor. Thanks guys!
Workaround: To clear a given property, basing on some logic which determines if it should be cleared. For example this.radRichTextEditor1.CommandExecuting += (s, e) => { if (e.Command is ChangeStyleNameCommand) { var style = this.radRichTextEditor1.Document.StyleRepository.GetValueOrNull(e.CommandParameter.ToString()); if (style.Type == Telerik.WinForms.Documents.Model.Styles.StyleType.Paragraph) { Paragraph paragraph = this.radRichTextEditor1.Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph; foreach (Span span in paragraph.EnumerateChildrenOfType<Span>()) { span.ClearValue(Span.FontFamilyProperty); span.ClearValue(Span.FontSizeProperty); } } } };
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.
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; } }
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.
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: create a document like the one below, then try to add a comment for an element in the paragraph with the bookmarks Public Class Form2 Sub New() InitializeComponent() Dim document As New RadDocument() Dim section As New Section() Dim paragraph As New Paragraph() Dim span As New Span("Content prior range[") Dim span2 As New Span("]Content after range") Dim readOnlyContent As New Span("READ ONLY") Dim rangeStart As New ReadOnlyRangeStart() Dim rangeEnd As New ReadOnlyRangeEnd() rangeEnd.PairWithStart(rangeStart) paragraph.Inlines.Add(span) paragraph.Inlines.Add(rangeStart) paragraph.Inlines.Add(readOnlyContent) paragraph.Inlines.Add(rangeEnd) paragraph.Inlines.Add(span2) section.Blocks.Add(paragraph) document.Sections.Add(section) Dim bmSection As New Section() Dim bmParagraph As New Paragraph() Dim bmSpan As New Span("Content prior bookmark[") Dim bmSpan2 As New Span("]Content after bookmark") Dim bmContent As New Span("Content in Bookmark") Dim bmRangeEnd As New BookmarkRangeEnd() Dim bmRangeStart = DirectCast(bmRangeEnd.CreatePairedStart(), BookmarkRangeStart) bmRangeStart.Name = System.Guid.NewGuid().ToString() bmParagraph.Inlines.Add(bmSpan) bmParagraph.Inlines.Add(bmRangeStart) bmParagraph.Inlines.Add(bmContent) bmParagraph.Inlines.Add(bmRangeEnd) bmParagraph.Inlines.Add(bmSpan2) bmSection.Blocks.Add(bmParagraph) document.Sections.Add(bmSection) Me.RadRichTextEditor1.Document = document End Sub End Class
Steps to reproduce: 1. Use the following code snippet: public partial class Form1 : RadForm { public Form1() { InitializeComponent(); this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.radRichTextEditor1.Document = ImportDocx(@"..\..\lorem.docx"); this.radRichTextEditor1.LayoutMode = DocumentLayoutMode.Paged; this.radRichTextEditor1.ChangeSectionPageSize(PaperTypeConverter.ToSize(PaperTypes.A3)); this.radRichTextEditor1.ChangeSectionPageOrientation(PageOrientation.Landscape); } private void radButton1_Click_1(object sender, EventArgs e) { this.radRichTextEditor1.PrintPreview(); } private void radButton3_Click(object sender, EventArgs e) { this.radRichTextEditor1.Print(true); } } Calling the PrintPreview method, the page orientation is updated in PrintSettingDialog. However, the page size is not updated correctly. As result, the printed document is not correct. If you call the Print method, the page size and orientation are not updated and the document is printed as in A4/Portrait instead A3/Landscape. Workaround: Use RadPrintDocument: private void radButton2_Click(object sender, EventArgs e) { RadPrintDocument radPrintDocument1 = new RadPrintDocument(); radPrintDocument1.AssociatedObject = this.radRichTextEditor1; radPrintDocument1.Landscape = true; PaperSize ps = new PaperSize(); ps.RawKind = (int)PaperKind.A3; radPrintDocument1.DefaultPageSettings.PaperSize = ps; radPrintDocument1.Print(); //this.radRichTextEditor1.Print(true, radPrintDocument1); }
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 RTF specifications states that the header of the document should start with "\rtfN" where N is the version of the RTF. Currently, the RtfFormatProvider do not save the version, but only "\rtf". Most software handles this case, but in some cases the document cannot be read.
How to reproduce: 1. Run the Mail Merge example (QSF) 2. Select the image inside the document and move it to another position