When an element refers to a style name of a style that is not present in the document, trying to export it with RtfFormatProvider leads to KeyNotFoundException. A similar document could be produced when copying content from MS Word. The same case is working properly with the other providers as well as in WordsProcessing (check the related 133762). Workaround: Check all the styles used in the document and remove the NextStyleName or LinkedStyle values that point to non-existing in the document styles. Available in LIB Version 2018.1.212.
Pressing Delete at the end of a paragraph leads to merging the content of the current paragraph with the next block. However, when the deleted paragraph contains a single space, the layout stops updating after pressing Delete.
Steps to reproduce:
1. Create two tables with paragraph between them
2. Add a space to the paragraph
3. Press Delete (when the caret is just after the space)
Observed: The layout is not updated after this and further modifications
Workaround:
Delete the space before deleting the paragraph:
private void RadRichTextBox_CommandExecuting(object sender, Telerik.Windows.Documents.RichTextBoxCommands.CommandExecutingEventArgs e)
{
if (e.Command is DeleteCommand && this.radRichTextBox.Document.Selection.IsEmpty)
{
Paragraph currentParagraph = this.radRichTextBox.Document.CaretPosition.GetCurrentParagraphBox().AssociatedParagraph;
if (currentParagraph.Inlines.Count==1 && string.IsNullOrWhiteSpace((currentParagraph.Inlines.First as Span).Text))
{
this.radRichTextBox.Delete(true);
}
}
}
Currently, the underline is always exported as single. Add support for the other types that can be used in RadRichTextBox.
When the width of the tab stop is set to a negative value, an ArgumentOutOfRangeException is thrown on import. Other applications handle this case and convert the value to a positive number. Fix is available in LIB Version 2018.1.326.
A specific combination of document elements causes an infinite measure loop.
An additional line should be inserted between the inner div and the span where the first <br> is inserted.
Add support for USERNAME field. The field is evaluated using the document metadata. Description: https://support.office.com/en-us/article/field-codes-username-field-f564f516-823f-4fb9-9da8-9b6312148053?ui=en-US&rs=en-US&ad=US
Add support for CREATEDATE field. The field is evaluated using the document metadata. Description: https://support.office.com/en-us/article/field-codes-createdate-field-440080d1-2d34-494f-bdca-9d451d659d46?ui=en-US&rs=en-US&ad=US
Add support for FILENAME field. The field could be evaluated using the last opened/saved file name. Description:https://support.office.com/en-us/article/field-codes-filename-field-a2946f1b-d822-47dc-ba32-4482aece26bc?ui=en-US&rs=en-US&ad=US
When a table in HTML document has width set to 0 (through an attribute or CSS style), the table is imported with 0 width in the document model. This makes the content unreadable.
Instead, such width should be treated as if width is not set at all - this way the layout will use only the widths set to the cells.
Workaround: Clear the PreferredWidth property if it is 0.
var tables = this.radRichTextBox.Document.EnumerateChildrenOfType<Table>();
foreach (var table in tables)
{
if (table.PreferredWidth.Value == 0)
{
table.PreferredWidth = null;
}
}
Fix available in LIB Version 2018.1.326.
Font weight, size and other current editing style properties are not preserved when Shift + Enter key combination is used and the user continues typing. Note: this is true not only for font weight but for other styling properties such as size, italic etc.
The customers need to customize the dialogs for opening and saving a file. For example, they need to set a default path or extension. With the current implementation, this can be achieved by customizing the commands. Expose an API allowing them to achieve that easily.
When the background is defined for a table or a cell, it should be inherited by the paragraphs inside. Currently, the paragraphs are with the background defined in the default style.
If a document does not have definition for font size in all levels of the font hierarchy, then all runs that do not have font size set locally, will be imported with font size 9.5.
In Microsoft Word, in this case, the font size value is 10.
Workaround: Set the FontSize of the default document style after the document is imported:
RadDocument reportDocument1;
using (FileStream inputStream = new FileStream(@"C:\Original.docx", FileMode.Open))
{
reportDocument1 = provider1.Import(inputStream);
reportDocument1.StyleRepository[RadDocumentDefaultStyles.DefaultDocumentStyleName].SpanProperties.FontSize = Unit.PointToDip(10);
}
using (FileStream output = new FileStream(@"C:\test.docx", FileMode.OpenOrCreate))
{
provider1.Export(reportDocument1, output);
}
Inserting image inline from stream changes its size dramatically.
Run the following code to reproduce:
RadDocument document = new RadDocument();
RadDocumentEditor editor = new RadDocumentEditor(document);
//editor.Insert("some text");
using (FileStream stream = File.OpenRead(@"C:\Temp\picture.jpg"))
{
editor.InsertImage(stream, ".png");
}
File.WriteAllBytes($@"d:\Temp\test\test_doc.pdf", new PdfFormatProvider().Export(document));
The issue is observable after 2017.2.614.
When document with TOC field is exported to PDF, the hyperlinks in the TOC field are exported with blue fore color and blue underline (with the default hyperlink styling). Instead, they should be exported with the fore color visible in the document.
Workaround: Clear the hyperlink style from the spans inside the TOC:
var firstTocRange = this.radRichTextBox.Document.EnumerateChildrenOfType<FieldRangeStart>().Where(frs => frs.Field is TableOfContentsField).First();
this.radRichTextBox.Document.Selection.SelectAnnotationRange(firstTocRange);
foreach (var spanLayoutBox in this.radRichTextBox.Document.Selection.GetSelectedBoxes<SpanLayoutBox>())
{
spanLayoutBox.AssociatedSpan.Style = null;
}
Currently there are three places in the UI which contain a list of font sizes which could be applied to the content, and all of them could be customized separately:
- RadRichTextBoxRibbonUI - could be customized by directly editing the content of the ribbon in the XAML file.
- FontPropertiesDialog - could be customized by replacing the whole dialog (as SDK is available: https://github.com/telerik/xaml-sdk/tree/master/RichTextBox/CustomFontPropertiesDialog ), or a little hacky approach using the FindName method:
((ListBox)((Control)this.radRichTextBox.FontPropertiesDialog).FindName("fontSizeListBox")).ItemsSource = new List<double> { 10, 14, 16, 18, 20 };
- SelectionMiniToolBar - could be customized by changing the template of SelectionMiniToolBar
Provide API which allows customization at a single place. This API could be similar to (or even extension of) the already available Telerik.Windows.Document.Layout.FontManager class.
Deleting table right after merged fields are updated causes StackOverflowException.
The TxtFormatProvider always imports the document with UTF8 encoding. It will be great if users could change this setting in order to import document with different encodings.
When there is a hyperlink enclosed in another annotation (e.g comment, bookmark, read-only range), and the user moves the caret position just before or just after the hyperlink, and starts typing there, the text is inserted with the style of the hyperlink (by default, blue with blue underline). Instead, the text should be inserted without such style.