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.
33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using System;
|
|
using ClosedXML.Excel;
|
|
|
|
|
|
namespace ClosedXML_Examples
|
|
{
|
|
public class ColumnCells : IXLExample
|
|
{
|
|
|
|
public void Create(String filePath)
|
|
{
|
|
var workbook = new XLWorkbook();
|
|
var ws = workbook.Worksheets.Add("Column Cells");
|
|
|
|
var columnFromWorksheet = ws.Column(1);
|
|
columnFromWorksheet.Cell(1).Style.Fill.BackgroundColor = XLColor.Red;
|
|
columnFromWorksheet.Cells("2").Style.Fill.BackgroundColor = XLColor.Blue;
|
|
columnFromWorksheet.Cells("3,5:6").Style.Fill.BackgroundColor = XLColor.Red;
|
|
columnFromWorksheet.Cells(8, 9).Style.Fill.BackgroundColor = XLColor.Blue;
|
|
|
|
var columnFromRange = ws.Range("B1:B9").FirstColumn();
|
|
|
|
columnFromRange.Cell(1).Style.Fill.BackgroundColor = XLColor.Red;
|
|
columnFromRange.Cells("2").Style.Fill.BackgroundColor = XLColor.Blue;
|
|
columnFromRange.Cells("3,5:6").Style.Fill.BackgroundColor = XLColor.Red;
|
|
columnFromRange.Cells(8, 9).Style.Fill.BackgroundColor = XLColor.Blue;
|
|
|
|
workbook.SaveAs(filePath);
|
|
}
|
|
|
|
}
|
|
}
|