Page 1 of 1

RTF Question

Posted: Thu Sep 07, 2006 7:42 am
by EDV Gradl
Hi Team from Stimulsoft,

I want to use the GetValue Event of a RTF to calcuate some lines. Is it possible to format the lines in the event (e.g. set alignment, set bold etc)?

Thanks a lot

RTF Question

Posted: Fri Sep 08, 2006 12:33 am
by Vital
You can use following code in GetValue event of RichText

Code: Select all

StiRichTextBox rich = new StiRichTextBox();

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

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

rich.SelectionAlignment = StiRtfSelectionAlign.Center;
rich.SelectionColor = Color.Red;
rich.SelectionFont = new Font("Arial", 30);

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

rich.Dispose();