Subscript/Superscript - Possible?

Stimulsoft Reports.NET discussion
Post Reply
fphealthcare
Posts: 33
Joined: Sun Jul 02, 2006 6:06 pm
Location: New Zealand

Subscript/Superscript - Possible?

Post by fphealthcare »

Is it possible to show super and sub scripts on the report? I've tried using RichText, but that only allows you to change fonts, size, colors, and allows underlines and stikeouts, but not change to sub or superscipt. Is this possible?
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Subscript/Superscript - Possible?

Post by Vital »

You can use property RtfText of RichText. This property contains rtf text.

Thanks.
garethm
Posts: 7
Joined: Thu Aug 24, 2006 1:15 am

Subscript/Superscript - Possible?

Post by garethm »

Just to clarify that, if you use the RtfText property, you can specify raw rtf - and using raw rtf you use \sub and \super to indicate sub- and superscript, respectively.

e.g. SO{\sub 4}{\super -2} gives you SO followed by a subscript 4 and a superscript -2.
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Subscript/Superscript - Possible?

Post by Vital »


We will update our rtf editor. Please send message to support, we will send you patch, when it will be ready.

Thank you.
fphealthcare
Posts: 33
Joined: Sun Jul 02, 2006 6:06 pm
Location: New Zealand

Subscript/Superscript - Possible?

Post by fphealthcare »

I've downloaded the new version with the new rfg editor and it has sub/superscript working very well. I want to be able to change the text value (including formatting such as sub/superscript) of the rich text in code. How can this be done?

e.g.
I've got a rich text box RichText1. I want to change RichText1 to display "ABC123".

How can I do this?

Thanks
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

Subscript/Superscript - Possible?

Post by Vital »

Type following code in GetValue event of RichText

Code: Select all

RichTextBox rich = new RichTextBox();

//Unpack rtf text
rich.Rtf = StiRichText.UnpackRtf(System.Xml.XmlConvert.DecodeName(e.Value));

//Select rtf range
rich.SelectionStart = 0;
rich.SelectionLength = 3;

//Subscript
rich.SelectionCharOffset = -4;

//Superscript
rich.SelectionCharOffset = 4;

//Pack rtf text
e.Value = System.Xml.XmlConvert.EncodeName(StiRichText.PackRtf(rich.Rtf));

rich.Dispose();
Post Reply