This is a migrated thread and some comments may be shown as answers.

Mergefields style not being saved

1 Answer 27 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Ronald
Top achievements
Rank 1
Ronald asked on 23 Feb 2016, 04:04 PM

Hi,

 

Question, I'm using the RadRichtTextBox to create documents in our software and add mergefields. Right now when I change the font size of a mergefield it doesn't get saved for some reason. The style changes fine, but when I save the document and open it again it's back to the font's style default. If I change the font of any other text it works fine. See screenshot for an example.

 

Do you guys have any idea why this is happening? Any tips would be welcome.

1 Answer, 1 is accepted

Sort by
0
Boby
Telerik team
answered on 26 Feb 2016, 02:59 PM
Hello Ronald,

How are you changing the font size of the field? I would recommend setting it through the methods of RadRichTextBox/RadDocumentEditor, as changing directly the properties in the document model could be tricky:
radRichTextBox.Document.Selection.SelectAll();
radRichTextBox.ChangeFontSize(32);

Using this code, I was able to change the font size and preserve the formatting through export/import to docx, RTF and XAML. You may have to additionally manipulate the DocumentSelection to select just the needed part of the document.

In case this doesn't help: please describe how are you applying the formatting (source code), the document you are applying formatting to, and the format you are exporting to.

Regards,
Boby
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
RichTextBox
Asked by
Ronald
Top achievements
Rank 1
Answers by
Boby
Telerik team
Share this question
or