How to set RTF text to cell comment using XlsIO?
RTF text can be set to cell comments using the RichTextString class, as represented in the below code snippet.
C#
string commentText = "The At complete line Item Totals do not match the At Complete report subtotal. Missing template Mappings CCDR Validation."; // Adding RichText comment to cell range.AddComment().RichText.Text = commentText; IRichTextString rtf = range.Comment.RichText; // Formatting the comment IFont font = workbook.CreateFont(); font.Italic = true; font.Color = ExcelKnownColors.Red; font.Size = 15; rtf.SetFont(0, commentText.Length, font);
VB
Dim commentText As String = "The At complete line Item Totals do not match the At Complete report subtotal. Missing template Mappings CCDR Validation." ' Adding RichText comment to cell range.AddComment().RichText.Text = commentText Dim rtf As IRichTextString = range.Comment.RichText ' Formatting the comment Dim font As IFont = workbook.CreateFont() font.Italic = True font.Size = 15 rtf.SetFont(0, commentText.Length, font)
Conclusion
I hope you enjoyed learning about how to set RTF text to a cell comment using XlsIO.
You can refer to our XIsIO’s feature tour page to learn about its other groundbreaking features. Explore our UG documentation and online demos to understand how to manipulate data in Excel documents.
If you are an existing user, you can access our latest components from the License and Downloads page. For new users, you can try our 30-day free trial to check out XlsIO and other Syncfusion components.
If you have any queries or require clarification, please let us know in the comments below or contact us through our support forums or feedback portal. We are always happy to assist you!