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

How to ignore font size

3 Answers 103 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Dave
Top achievements
Rank 1
Dave asked on 05 Sep 2017, 08:19 PM

I'm trying to find a way to render all text in a RadRichTextBox in a single font size, ignoring the document style(s).

Does anybody know of a place to start?

Thanks

3 Answers, 1 is accepted

Sort by
0
Tanya
Telerik team
answered on 08 Sep 2017, 01:41 PM
Hi Dave,

Since the styling mechanism is pretty complex and font size can be applied through styles, locally or through inheritance, to ensure that the document has a single font size no matter what has been set, you will need to set the local property for each span.You can achieve that through the Selection API:
this.radRichTextBox.Document.Selection.SelectAll();
this.radRichTextBox.ChangeFontSize(Unit.PointToDip(10));
this.radRichTextBox.Document.Selection.Clear();

You can use the DocumentChanged event of RadRichTextBox to apply these changes. 

Hope this helps.

Regards,
Tanya
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Michael
Top achievements
Rank 1
Veteran
answered on 03 Oct 2017, 09:23 PM

Thanks Tanya.
I'd rather not flatten down the actual font sizes - i'll want that info at a later stage in the files' workflow. 

I was hoping for a setting/hook/override in the draw/render pipeline.

0
Tanya
Telerik team
answered on 06 Oct 2017, 02:33 PM
Hello Michael,

How a document is shown in RadRichtextBox strongly depends on the style settings of the document. If I correctly understand, your requirement is to change the way the document is visualized without actually changing its style settings. If so, I am afraid that this is not possible.

Regards,
Tanya
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RichTextBox
Asked by
Dave
Top achievements
Rank 1
Answers by
Tanya
Telerik team
Michael
Top achievements
Rank 1
Veteran
Share this question
or