Mergefields style not being saved

2 posts, 0 answers
  1. Ronald
    Ronald avatar
    7 posts
    Member since:
    Mar 2015

    Posted 23 Feb Link to this post

    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.

  2. Boby
    Admin
    Boby avatar
    595 posts

    Posted 26 Feb Link to this post

    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
  3. DevCraft banner
Back to Top