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.
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using ClosedXML.Excel;
|
||||
|
||||
|
||||
namespace ClosedXML_Examples.Rows
|
||||
{
|
||||
public class RowCollection : IXLExample
|
||||
{
|
||||
#region Variables
|
||||
|
||||
// Public
|
||||
|
||||
// Private
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
// Public
|
||||
|
||||
// Private
|
||||
|
||||
// Override
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Events
|
||||
|
||||
// Public
|
||||
|
||||
// Private
|
||||
|
||||
// Override
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
// Public
|
||||
public void Create(String filePath)
|
||||
{
|
||||
var workbook = new XLWorkbook();
|
||||
var ws = workbook.Worksheets.Add("Rows of a Range");
|
||||
|
||||
// All rows in a range
|
||||
ws.Range("A1:B2").Rows().Style.Fill.BackgroundColor = XLColor.DimGray;
|
||||
|
||||
var bigRange = ws.Range("B4:C17");
|
||||
|
||||
// Contiguous rows by number
|
||||
bigRange.Rows(1, 2).Style.Fill.BackgroundColor = XLColor.Red;
|
||||
|
||||
// Contiguous rows by number
|
||||
bigRange.Rows("4:5").Style.Fill.BackgroundColor = XLColor.Blue;
|
||||
|
||||
// Spread rows by number
|
||||
bigRange.Rows("7:8,10:11").Style.Fill.BackgroundColor = XLColor.Orange;
|
||||
|
||||
// Using a single number
|
||||
bigRange.Rows("13").Style.Fill.BackgroundColor = XLColor.Cyan;
|
||||
|
||||
// Adjust the height
|
||||
ws.Rows().Height = 15;
|
||||
|
||||
var ws2 = workbook.Worksheets.Add("Rows of a Worksheet");
|
||||
|
||||
// Contiguous rows by number
|
||||
ws2.Rows(1, 2).Style.Fill.BackgroundColor = XLColor.Red;
|
||||
|
||||
// Contiguous rows by number
|
||||
ws2.Rows("4:5").Style.Fill.BackgroundColor = XLColor.Blue;
|
||||
|
||||
// Spread rows by number
|
||||
ws2.Rows("7:8,10:11").Style.Fill.BackgroundColor = XLColor.Orange;
|
||||
|
||||
// Using a single number
|
||||
ws2.Rows("13").Style.Fill.BackgroundColor = XLColor.Cyan;
|
||||
|
||||
// Adjust the height
|
||||
ws2.Rows("1:13").Height = 15;
|
||||
|
||||
workbook.SaveAs(filePath);
|
||||
}
|
||||
|
||||
// Private
|
||||
|
||||
// Override
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user