WSk
WSk

Reputation: 303

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.

Upvotes: 8

Views: 9091

Answers (1)

Raidri
Raidri

Reputation: 17560

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.

Upvotes: 16

Related Questions