Syncfusion.XlsIO.Base
Example 


ClearFormatting Method (IRichTextString)

Clears string formatting.
Syntax
'Declaration
 
Sub ClearFormatting() 
'Usage
 
Dim instance As IRichTextString
 
instance.ClearFormatting()
void ClearFormatting()
Example
The following code illustrates how to clear the formatting applied to the RichText.
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);
            
            //Clear format
            richText.ClearFormatting();
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also