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

How to set font when using Import?

2 Answers 177 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Rob A. asked on 12 Dec 2020, 07:21 PM

Reading the article here, it seems to indicate that setting of the font via control reference will not change the font on an imported document. 

https://docs.telerik.com/devtools/wpf/controls/radrichtextbox/frequently-asked-questions

 

Dim appPathAndFile As String = System.AppDomain.CurrentDomain.BaseDirectory & "\TreeScapesLog.txt"
Dim docProvider As New TxtFormatProvider
Using input As Stream = File.OpenRead(appPathAndFile)
    Dim docLogFile As RadDocument = docProvider.Import(input)
    rtbLogFile.Document = docLogFile
End Using

 

What that article suggests is the TxtFormatProvider strips the content of all formatting ... but it seems to assign a very large default font size.  How do I go about changing that font size when using TxtFormatProvider.Import ... I couldn't find any examples?

Cheers, Rob.

 

2 Answers, 1 is accepted

Sort by
0
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 12 Dec 2020, 07:49 PM

IGNORE ... I missed this following setting in the XAML

DocumentInheritsDefaultStyleSettings="True"

Cheers, Rob.

0
Dimitar
Telerik team
answered on 14 Dec 2020, 08:09 AM

Hi Rob,

This is indeed the correct solution. Do not hesitate to contact us if you have any questions.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
RichTextBox
Asked by
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Dimitar
Telerik team
Share this question
or