How to add text with sub/supstring?

1 Answer 31 Views
WordsProcessing
Ivan
Top achievements
Rank 3
Iron
Iron
Iron
Ivan asked on 14 Dec 2023, 02:21 PM
Please help with adding some text into run with substring numbers (chemical formula)
How to do this?

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 18 Dec 2023, 10:04 AM

Hello Ivan,

From what I understand you would like to insert subscript (or superscript) numbers in text content. That can be achieved through the BaselineAlignment property of a Run.

However, the normal and subscript parts of the text must be separate runs, so that they each have different formatting.

Example:

paragraph.Inlines.AddRun("normal text");
var subscriptText = paragraph.Inlines.AddRun("1");
subscriptText.BaselineAlignment = BaselineAlignment.Subscript;

Hope this helps.

Regards,
Yoan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
WordsProcessing
Asked by
Ivan
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Yoan
Telerik team
Share this question
or