Articles in this section
Category / Section

How to set RTF text to cell comment using XlsIO?

1 min read

RTF text can be set to cell comments using 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)

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied