Format string (color- font ... ) pass in a cell

I want to format cell as in a below picture



cells[0, 0].PutValue("???");
cells[0, 0].Style.

Thanks with reading and helps.

Hi,

Please see the code below, I have made use of the Cell.HtmlString property to achieve this result.

I have also attached the output file and the screenshot. The code is fully commented, so you will not have a trouble getting it.

C#


//Create a workbook
Workbook workbook = new Workbook();

//Access its worksheet
Worksheet worksheet = workbook.Worksheets[0];

//Access cell A6
Cell cellA6 = worksheet.Cells[“A6”];


//Use HtmlString property to set the stylish text using html
cellA6.HtmlString = “<font style=‘color:red’>Red <font style=‘color:blue’>Blue <font style=‘color:green’>Green <font style=‘font-style:bold’>Bold <font style=‘font-style:italic’>Italic”;

//Save the workbook

workbook.Save("f:\\downloads\\output.xlsx", SaveFormat.Xlsx);

Hi,

And, if you want to use cells’ style/formatting to achieve your requirement, you may see the following topic:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/formatting-selected-characters-in-a-cell.html

thank you.

Thank you very much.