Files
ClosedXML/ClosedXML_Examples/Styles/StyleFill.cs
T
Thom Lamb 2cd6df6481 Initial commit of the ClosedXML library
Establishes the foundational structure, core Excel functionality, and tooling.

- Implements base components for cells, ranges, columns, and rows.
- Integrates a custom calculation engine with a wide range of Excel functions.
- Adds comprehensive support for styling, conditional formatting, data validation, comments, pictures, and charts.
- Configures build setup, project metadata (NuGet), and developer guidelines.
- Includes editor and Git attributes for consistent code style and line endings.
2026-06-23 11:02:53 -05:00

28 lines
872 B
C#

using ClosedXML.Excel;
using System;
namespace ClosedXML_Examples.Styles
{
public class StyleFill : IXLExample
{
public void Create(String filePath)
{
var workbook = new XLWorkbook();
var ws = workbook.Worksheets.Add("Style Fill");
var co = 2;
var ro = 1;
ws.Cell(++ro, co + 1).Value = "BackgroundColor = Red";
ws.Cell(ro, co).Style.Fill.BackgroundColor = XLColor.Red;
ws.Cell(++ro, co + 1).Value = "PatternType = DarkTrellis; PatternColor = Orange; BackgroundColor = Blue";
ws.Cell(ro, co).Style.Fill.PatternType = XLFillPatternValues.DarkTrellis;
ws.Cell(ro, co).Style.Fill.PatternColor = XLColor.Orange;
ws.Cell(ro, co).Style.Fill.BackgroundColor = XLColor.Blue;
workbook.SaveAs(filePath);
}
}
}