Syncfusion.XlsIO.Base
Example 


RichText Property (IRange)

Gets string with rich text formatting in the Range. Read-only.
Syntax
'Declaration
 
ReadOnly Property RichText As IRichTextString
'Usage
 
Dim instance As IRange
Dim value As IRichTextString
 
value = instance.RichText
IRichTextString RichText {get;}
Example
The following code illustrates how to set rich text formatting in the range.
using Syncfusion.XlsIO;
            
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 text";
            
            //Set font
            IFont font = style.Font;
            
            //Set color
            font.Color = ExcelKnownColors.Red;
            
            //Set rich text font
            richText.SetFont(0, 5, font);
            
            //Set color
            font.Color = ExcelKnownColors.Blue;
            
            //Set rich text font
            richText.SetFont(6, 10, font);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also