Cell Fill is one kind of cell format settings in Excel, which includes cell background color and pattern style. With cell fill, the appearance of Excel file can be beautified. Also, data in cell which is set background color or pattern style can be more obvious.
Spire.XLS for .NET, a professional .NET Excel component on manipulating Excel files, enables users to set in Excel. And this guide will focuses on how to realize Excel cell fill in C#, VB.NET, including cell background color and pattern style settings. User can set style property of CellRange class which Spire.XLS for .NET provides to get wanted background color and pattern style of one specified cell or a cell range. The following screenshot shows the result- workbook without cell fill setting.
Sample Code for Setting Cell Fill in Excel with C#, VB.NET
worksheet.Range["A7:F7"].Style.Color = Color.Yellow; worksheet.Range["A8:F8"].Style.FillPattern = ExcelPatternType.Percent125Gray;
worksheet.Range("A7:F7").Style.Color = Color.Yellow worksheet.Range("A8:F8").Style.FillPattern = ExcelPatternType.Percent125Gray