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

Free Support Forum - aspose.com

How to Set Row Color Upto Column Created


I want to set color of Row upto column created. In other words.

Row contain 6 columns , I wan to color upto 6 columns.



Thanks for your inquiry.

Well, you may either set the formattings for each cell for your desired range of cells, check: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/approaches-to-format-data-in-cells.html , http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/colors-background-patterns.html or create a range based on your desired cells, create a style object with your desired formattings and finally use apply style to that range.


Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
Style style = workbook.Styles[workbook.Styles.Add()];
style.Font.Color = Color.Red;
style.ForegroundColor = Color.Yellow;
style.Pattern = BackgroundType.Solid;
StyleFlag flag = new StyleFlag();
flag.FontColor = true;
flag.CellShading = true;

Range range = sheet.Cells.CreateRange("A1", "F3");


Thank you.