Coloring to cell

How to apply back ground color and text color of a cell with using of style


Thanks in advance

Hi,


See the sample code for your reference for your requirements:

Sample code:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells[“A1”].PutValue(“Hello World!”);
Style style = worksheet.Cells[“A1”].GetStyle();
style.ForegroundColor = Color.Yellow;
//style.ForegroundColor = Color.FromArgb(255, 153, 0);
style.Pattern = BackgroundType.Solid;
style.Font.Color = Color.Red;
worksheet.Cells[“A1”].SetStyle(style);
workbook.Save(“e:\test2\cellBGtest.xlsx”);

Moreover, please check the documents in the section for your complete reference on formatting cells/data etc:
http://www.aspose.com/docs/display/cellsnet/Working+with+Data+Formatting

Thanks,