//create a new workbook var workbook = new GrapeCity.Documents.Excel.Workbook(); IWorksheet worksheet = workbook.Worksheets[0]; IComment commentC3 = worksheet.Range["C3"].AddComment("This is a rich text comment:\r\n"); //config the paragraph's style. commentC3.Shape.TextFrame.TextRange.Paragraphs[0].Font.Bold = true; //add runs for the paragraph. commentC3.Shape.TextFrame.TextRange.Paragraphs[0].Runs.Add("Run1 font size is 15.", 1); commentC3.Shape.TextFrame.TextRange.Paragraphs[0].Runs.Add("Run2 font strikethrough.", 2); commentC3.Shape.TextFrame.TextRange.Paragraphs[0].Runs.Add("Run3 font italic, green color."); //config the first run of the paragraph's style. commentC3.Shape.TextFrame.TextRange.Paragraphs[0].Runs[1].Font.Size = 15; //config the second run of the paragraph's style. commentC3.Shape.TextFrame.TextRange.Paragraphs[0].Runs[2].Font.Strikethrough = true; //config the third run of the paragraph's style. commentC3.Shape.TextFrame.TextRange.Paragraphs[0].Runs[3].Font.Italic = true; commentC3.Shape.TextFrame.TextRange.Paragraphs[0].Runs[3].Font.Color.RGB = Color.Green; //show comment. commentC3.Visible = true; commentC3.Shape.WidthInPixel = 300; commentC3.Shape.HeightInPixel = 100;
' Create a new Workbook Dim workbook As New Workbook Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim commentC3 As IComment = worksheet.Range!C3.AddComment("This is a rich text comment:" & vbCrLf) 'config the paragraph's style. commentC3.Shape.TextFrame.TextRange.Paragraphs(0).Font.Bold = True 'add runs for the paragraph. commentC3.Shape.TextFrame.TextRange.Paragraphs(0).Runs.Add("Run1 font size is 15.", 1) commentC3.Shape.TextFrame.TextRange.Paragraphs(0).Runs.Add("Run2 font strikethrough.", 2) commentC3.Shape.TextFrame.TextRange.Paragraphs(0).Runs.Add("Run3 font italic, green color.") 'config the first run of the paragraph's style. commentC3.Shape.TextFrame.TextRange.Paragraphs(0).Runs(1).Font.Size = 15 'config the second run of the paragraph's style. commentC3.Shape.TextFrame.TextRange.Paragraphs(0).Runs(2).Font.Strikethrough = True 'config the third run of the paragraph's style. commentC3.Shape.TextFrame.TextRange.Paragraphs(0).Runs(3).Font.Italic = True commentC3.Shape.TextFrame.TextRange.Paragraphs(0).Runs(3).Font.Color.RGB = Color.Green 'show comment. commentC3.Visible = True commentC3.Shape.WidthInPixel = 300 commentC3.Shape.HeightInPixel = 100 ' save to an excel file workbook.Save("SetRichTextForComment.xlsx")