Syncfusion.XlsIO.Base
Example 


RtfText Property

Returns text in rtf format. Read-only.
Syntax
'Declaration
 
Property RtfText As String
'Usage
 
Dim instance As IRichTextString
Dim value As String
 
instance.RtfText = value
 
value = instance.RtfText
string RtfText {get; set;}
Example
The following code illustrates how to access the RtfText of the RichText.
using Syncfusion.XlsIO;
using System;
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Create style
            IStyle style = workbook.Styles.Add("CustomStyle");
            
            //Set rich text
            IRichTextString richText = worksheet["C2"].RichText;
            
            //Set text
            richText.Text = "Sample";
            
            //Set font
            IFont font = style.Font;
            
            //Set color
            font.Color = ExcelKnownColors.Red;
            
            //Set rich text font
            richText.SetFont(0, 5, font);
            
            //Get rtf text string
            Console.Write(richText.RtfText);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
            Console.ReadKey();
        }
    }
}
//Output will be
//{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset1 Calibri;}}{\colortbl;\red255\green0\blue0;}{\f0\fs22\cf1\u83*\u97*\u109*\u112*\u108*\u101*}}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also