Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use different colors of texts in same Excel cell using ClosedXML?

How to use different colors of texts in the same Excel cell using ClosedXML?

worksheet.Cell(1,1).Value.Character[StartIndex, NoOfChar].Font.Color....??

ClosedXML doesn't have something like above, please help me to use two different font colors in the same cell.

like image 606
WSk Avatar asked Sep 21 '16 12:09

WSk


1 Answers

Use RichText to style different parts of the cell, for example:

worksheet.Cell(1,1).RichText.Substring(StartIndex, NoOfChar).SetFontColor(XLColor.Red);

See the documentation for more details.

like image 153
Raidri Avatar answered Sep 22 '22 14:09

Raidri