Wrong FontSize when loading .docx file in SF RichTextBoxAdv

Hi

When a .docx file is loaded into the sfRichTextBox control or into the demo included in the WPF demos (Document Editor), the font size of the loaded file is observed to be larger than the actual size displayed in MS Word. I've attached screenshots of the Word control, the demo of the control, and the Word document.

Regards, 

Jesús


Attachment: Screenshots_aeedabcb.rar

8 Replies

KG Kalaivannan Ganesan Syncfusion Team April 7, 2025 02:02 PM UTC

Jesús, we are currently investigating the reported issue on our end and will provide further updates by April 8, 2025



KG Kalaivannan Ganesan Syncfusion Team April 8, 2025 10:34 AM UTC

Jesús, We have analyzed the cause of the reported issue regarding the font size differences in loaded documents within the SfRichTextBoxAdv control.

Currently, all properties in SfRichTextBoxAdv use pixel units as the standard, meaning that font sizes are preserved and displayed in pixels, whereas Microsoft Word maintains and displays font sizes in point units.

In your case, a font size of 12 points is converted to 16 pixels and is displayed as such in the SfRichTextBoxAdv control.

For your reference, here is the formula used for converting font size between points and pixels:

  • Font size in pixels = Font size in points × (96 / 72)

To meet your requirement of displaying font size in points, we can implement an IValueConverter to convert between pixel and point values during property bindings.

We’ve also created a sample application where we customized the Mini Toolbar's font size combo box in SfRichTextBoxAdv to display font sizes in point units using a unit converter. The application and an illustrative video are attached below for your reference.


Attachment: SfRichTextBoxAdv_FontSize_ea22e8f8.zip


JE Jesús April 8, 2025 02:33 PM UTC

Hi  Kalaivannan :

Perfect, it works well.


Thank you.


Regards 

Jesús



KV Kirthika Vijayagiri Syncfusion Team April 9, 2025 04:59 AM UTC

Hi Jesús,

Thank you for the update. Please get back to us if you need any further assistance.

Regards,

Kirthika



JE Jesús April 9, 2025 11:08 AM UTC

Hi Kirthika

If possible, in the ribbon associated with the SfRichTextBoxAdv control, could you tell me how to implement the same code to display the FontSize in points, Word-style? As an improvement, I propose implementing a property/method that would allow its configuration in points or pixels.


Regards,

Jesús




KG Kalaivannan Ganesan Syncfusion Team April 10, 2025 01:30 PM UTC

Hi Jesús,

The SfRichTextRibbon control is a customized Ribbon that provides the primary functionalities for the WPF RichTextBox (SfRichTextBoxAdv) control. Unfortunately, it does not support adding or removing items directly.

However, you can implement your own customized Ribbon using the standard Ribbon control to suit your specific requirements for SfRichTextBoxAdv.

Please refer to the following knowledge base article for more details:
How to customize SfRichTextRibbon in WPF RichTextBox (SfRichTextBoxAdv)

We’ve also created a sample application demonstrating a customized ribbon integrated with SfRichTextBoxAdv. In this sample, the font size combo box in the ribbon displays font sizes in points, using a pixel-to-point converter.


Attachment: CustomizedSfRichTextRibbonFontSize_4b8129f1.zip


JE Jesús April 11, 2025 10:40 AM UTC

Hi  Kalaivannan

Thank you, very good example!!!


Regards, 

Jesús




KG Kalaivannan Ganesan Syncfusion Team April 12, 2025 01:03 PM UTC

Hi Jesús,

Thank you for the update. Please get back to us if you need any further assistance.

Regards,
Kalaivannan Ganesan


Loader.
Up arrow icon