As a user, I'd like to have a way to determine what document elements or layout boxes are in the view port. I may need them in order to: - Modify something else in the UI depending on them. For example, if a hyperlink or bookmark is scrolled in the viewport, enable buttons outside RichTextBox that execute specific actions. - Implement formatting changes to the visible elements only in scenarios like a code editor. Right now, the only way to obtain the visible boxes is to implement a UI layer, however, layers are intended for scenarios in which you'd like to modify the presentation of the control's content and may not be a good idea to utilize them for formatting changes or other actions.
When trying to export a document containing InlineUIContainer inside a read-only range, the XamlWriter.Save() method that is used in XamlFormatProvider.Serialize() throws StackOverflow exception. Sample code to reproduce the exception: InlineUIContainer container = new InlineUIContainer(); Button btn = new Button(); btn.Content = "Sample Button"; btn.Width = 70; btn.Height = 30; container.UiElement = btn; ReadOnlyRangeStart start = new ReadOnlyRangeStart(); ReadOnlyRangeEnd end = new ReadOnlyRangeEnd(); end.PairWithStart(start); this.rtb.InsertInline(container); this.rtb.Document.Selection.SelectAll(); this.rtb.InsertAnnotationRange(start, end); XamlFormatProvider provider = new XamlFormatProvider(); string content = provider.Export(this.rtb.Document); File.WriteAllText(@"c:\temp\asd.xaml", content);
Implement a Page Setup dialog which allows the users to modify Margins, Layout, Page Size, etc. of the document.
The caret of RadRichTextBox appears only when the text is selected. Once you try to reorder the letters within its content, it appears. The issue is caused when ScrollViewer control has different than the default style for the corresponding theme and there are set Padding and/or Margin properties. Workaround: the template of the Caret should be edited and Style="{x:Null}" should be set on the ScrollViewer which is defined inside the Caret control template.
When ScaleFactor is set to less that (1,1), this causes the caret to disappear at specific positions in the document. These positions depend on the exact value of the scale factor. The focus is still in the editor and users can type. Note that if the scale factor changes, the positions where the caret is not visualized will change as well.
In MS Word, images can have strikethrough formatting. In RadDocument's model, this is property of Spans only.
Actually, when we go to image editor from the RadRichTextBox, we've got the original image's size but not the width and height in the document. When we need to format pictures of a document with equal size, we are using the document's size, not the picture's size. Thanks
For example, if the document has "Times New Roman" as a default font family, the "TableNormal" style doesn't have set that property and there is a Table element in the header - the value is not properly obtained ("Verdana" is applied, which is the default value for that Span property). The problem is observed for all default span style properties. Workaround: Change the table style by setting the necessary properties from the default style. For example for the font family: object documentFontFamilyPropertyValue = this.radRichTextBox.Document.Style.GetPropertyValue(Span.FontFamilyProperty); foreach (StyleDefinition tableStyle in this.radRichTextBox.Document.StyleRepository.Where(s => s.Type == StyleType.Table && s.BasedOn == null)) { StylePropertyBase styleProperty = tableStyle.GetProperty(Span.FontFamilyProperty); if (styleProperty.ValueSource == RadValueSource.Default) { tableStyle.SetPropertyValue(Span.FontFamilyProperty, documentFontFamilyPropertyValue); } }
When a list item with applied first line indent is exported to PDF, the bullets are with wrong indent (images attached) Partial workaround: Remove the first line indent and set it as left indent in order to preserve the visualization of the document editor.ChangeParagraphLeftIndent(paragraph.FirstLineIndent + paragraph.LeftIndent); editor.ChangeParagraphFirstLineIndent(0);
Workaround: Manipulate the clipboard content in CommandExecuting even handler: private void RichTextBox_CommandExecuting(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutingEventArgs e) { if (e.Command is PasteCommand) { DocumentFragment document = ClipboardEx.GetDocument(); bool hasChangedDocument = false; foreach (FieldRangeStart fieldStart in document.EnumerateChildrenOfType<FieldRangeStart>()) { foreach (Span span in fieldStart.Field.GetFragmentByDisplayMode(FieldDisplayMode.Code).EnumerateChildrenOfType<Span>()) { span.ForeColor = Colors.Black; hasChangedDocument = true; } } if (hasChangedDocument) { ClipboardEx.SetDocument(document); } } }
The TableStylesGallery keeps a reference to the document, which doesn't allow the GC to collect it. The issue is reproducible when the document is loaded in RadRichTextBox in the constructor of the window or in its Loaded event.
Please look for the same topic in the forum for context. @Todor: Am attaching the wmf file and png file that don't get rendered.
Images with display: none could be made not-visible in the UI. The other elements could be skipped and not imported.
In MS Word, decimal tab stops affect paragraph layout in table cells even if tab character is not inserted. The reasoning is that it's hard to insert tab symbol in table cell, as pressing Tab navigates to the next cell (Ctrl+Tab should be used, or default behavior should be configured).
When a table is copied (without a paragraph before it) and pasted as first element in a Section in RadRichTextBox with Track Changes enabled, accepting all changes throws (handled) InvalidCastException. Changes are not accepted. Workaround: Attach to RadRichTextBox.CommandExecuting event, and add paragraph before the table in the document fragment in the clipboard. private void RadRichTextBox_CommandExecuting(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutingEventArgs e) { if (e.Command is Telerik.Windows.Documents.RichTextBoxCommands.PasteCommand) { if (this.radRichTextBox.Document.IsTrackChangesEnabled) { DocumentFragment documentFromClipboard = ClipboardEx.GetDocument(); if (documentFromClipboard != null) { e.Cancel = true; RadDocument documentFormClipboard = documentFromClipboard.ToDocument(); if (documentFormClipboard.EnumerateChildrenOfType<Table>().Count() > 0) { Section firstSection = documentFormClipboard.Sections.FirstOrDefault(); if (firstSection.EnumerateChildrenOfType<Table>().Count() > 0) { if (firstSection.EnumerateChildrenOfType<Table>().FirstOrDefault() != null) { Table table = firstSection.EnumerateChildrenOfType<Table>().FirstOrDefault(); Paragraph paragraph = new Paragraph() { SpacingAfter = 0, SpacingBefore = 0, LineSpacing = 0, FontSize = 1 }; firstSection.Blocks.AddBefore(table, paragraph); RadDocumentEditor editor = new RadDocumentEditor(this.radRichTextBox.Document); DocumentFragment fragment = new DocumentFragment(documentFormClipboard); editor.InsertFragment(fragment); } } } } } } }
When table cell text alignment (including horizontal and vertical alignment) is applied to a specific part of the table (e.g. First Row, First Column, etc.), the horizontal alignment is not applied. Only the vertical alignment is applied. If the alignment is applied to the whole table, then everything works as expected.
When comments panel is closed while the caret is still in the comment body, most document commands (all except typing) continue to execute in the comment body. The bug is regression introduced in 2013 Q3. Workaround: save the document position of the caret before showing the comment and after hiding the comments' panel, apply the saved caret position to the document. Attached is a sample project with the fix.