We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Format portions of cell text (highlight- bold- etc...)

I need to be able to formats certain sentences within a cell of data within Cells.NET.


For example, if my client’s note contains 3 sentences I need to be able to highlight, bold or somehow make that 3rd sentence stand out so that it draws them to it. This will be a way for them to determine if a new sentence (note) has been added.

Does Cells.NET provide any functionality to handle this?

I saw an example of using “Textboxes” collection and the “Textbox” class. Is this the only option?

Thanks,
STL

Hi Travas,

Following code snippet will help you. If there is any issue, please feel free to reach us.

Code snippet:
string filename = @"C:\exceltrash\Sample_1.xlsx";
Workbook workbook = new Workbook();
int sheetIndex = workbook.Worksheets.Add();
Worksheet worksheet = workbook.Worksheets[sheetIndex];
int commentIndex = worksheet.Comments.Add("F5");
Comment objcomment = worksheet.Comments[commentIndex];
objcomment.Note = "This is my Comment";
objcomment.Characters(0, 10).Font.IsBold = false;
objcomment.Characters(11, 7).Font.Name = "Tahoma";
objcomment.Characters(11, 7).Font.Size = 15;
objcomment.Characters(11, 7).Font.Color = Color.Red;
objcomment.Characters(11, 7).Font.IsBold = true;
objcomment.Characters(11, 7).Font.IsItalic = true;
workbook.Save(filename, SaveFormat.Xlsx);

Thanks,