Unplanned
Last Updated: 31 Oct 2018 08:11 by ADMIN
ADMIN
Todor
Created on: 30 Oct 2015 07:13
Category: RichTextBox
Type: Bug Report
0
RichTextBox: StyleDefinitions with names existing in RadDocument are not imported during DocumentFragment insertion
Inserting DocumentFragment into RadDocument leads to loss of style definitions from the fragment which names are the same as some of the styles in the RadDocument's style repository. This causes loss of formatting of the text in the document fragment.

For example if in the fragment there is a style with style name "Style_1" and in the RadDocument exists a style with the same name, that style will be omitted during the insertion of the fragment into the document.

Workaround: Styles in the fragment could be renamed to avoid naming conflict with styles in the main document. For example, add the following code snippet right after the importing of the document and before the creation of the fragment:

                string styleSuffix = "_1";
                foreach (var importedStyle in rtfDoc.StyleRepository)
                {
                    importedStyle.Name = string.Concat(importedStyle.Name, styleSuffix);
                }

This will automatically change the styles of all elements with the renamed styles.
0 comments