ExcelDocumentWriter 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package ExcelDocumentWriter --version 1.0.2
                    
NuGet\Install-Package ExcelDocumentWriter -Version 1.0.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ExcelDocumentWriter" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExcelDocumentWriter" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="ExcelDocumentWriter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ExcelDocumentWriter --version 1.0.2
                    
#r "nuget: ExcelDocumentWriter, 1.0.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ExcelDocumentWriter@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ExcelDocumentWriter&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=ExcelDocumentWriter&version=1.0.2
                    
Install as a Cake Tool

EXAMPLE

The following code demonstrates how to use MiniExcel to generate an Excel file programmatically. <br> The file "Test.xlsx" will be automatically created and saved when the Dispose method is invoked. <br> This library is built on the Open XML SDK, so it works even without Microsoft Excel installed. Moreover, there are no restrictions unique to the Open XML SDK. <br> MiniExcel is a lightweight, meaning-driven Excel generator designed for clarity, performance, and independence from external dependencies.

Ver.1.0.1<br> Minor fixes, with target OS restrictions removed.

Ver.1.0.2<br> Removed unnecessary library references.

using HimClassLib9.ExcelDocumentWriter;

public void MatrixTest() {
	using (ExcelWorkbook workBook = new(@"C:\Users\MyAccount\.....\Test.xlsx")) {
		ExcelWorkSheet  workSheet1  =  workBook.AddWorksheet("Sheet01");
		//	If a sheet name is duplicated, it will be renamed to ensure it is unique.
		ExcelWorkSheet  workSheet2  =  workBook.AddWorksheet("Sheet01");

		this.HeaderDraw(workSheet1);
		this.HeaderDraw(workSheet2);
		this.SetFormula(workSheet1, true);
		this.SetFormula(workSheet2, false);
		this.SetBorder(workSheet1);
		this.SetBorder(workSheet2);
	}   //	The file is created and saved by the Dispose method.
}

private void HeaderDraw(ExcelWorkSheet workSheet) {
	workSheet.SetFreezePane(1, 1);
	workSheet.ColumnWidth(1, 10, 5.63D);   //	Set columns Width
	workSheet.ShowGridLines = false;       //	Hide the gridlines

	for (int idx = 1; idx < 10; idx++) {
		workSheet.CellValue(idx, (uint)(idx + 1), 1);   //	Set a value in the cell
		workSheet.CellValue(idx, 1, (uint)(idx + 1));   //	Set a value in the cell
	}
}

private void SetFormula(ExcelWorkSheet workSheet, bool mode) {
	workSheet.MoveTopLeft();    //	Reset to 'A1'
	workSheet.MoveDown();       //	Move to the beginning of the next line
	workSheet.MoveRight();      //	Move the cursor one cell to the right
	for (uint row = 1; row < 10; row++) {
		string  rowAddress  =   ExcelBookSheetSupport.GetCellReference(1, row + 1);
		for (uint col = 1; col < 10; col++) {
			string  colAddress  =   ExcelBookSheetSupport.GetCellReference(col + 1, 1);
			if (mode) {
				workSheet.CellFormula($"={colAddress}*{rowAddress}");   //	Set a formula in the cell
			} else {
				workSheet.CellFormula($"={colAddress}+{rowAddress}");   //	Set a formula in the cell
			}
			workSheet.MoveRight();  //	Move the cursor one position to the right
		}
		workSheet.MoveDown();       //	Move to the beginning of the next line
		workSheet.MoveRight();      //	Move the cursor one cell to the right
	}
}

private void SetBorder(ExcelWorkSheet workSheet) {
	workSheet.CellRangeFill(1, 2, 1, 10, "E2EFDA");
	workSheet.CellRangeFill(2, 1, 10, 1, "E2EFDA");
	workSheet.CellRangeFill(2, 2, 10, 10, "D9E1F2");
	//workSheet.CellRangeBorder(2, 2, 10, 10, BorderType.MATRIX, BorderLineValues.Thin);
	workSheet.CellRangeBorder("B2:J10", BorderType.MATRIX, BorderLineValues.Thin);
	//workSheet.CellRangeBorder(2, 2, 10, 10, BorderType.OUTERBOX, BorderLineValues.Thick);
	workSheet.CellRangeBorder("B2:J10", BorderType.OUTERBOX, BorderLineValues.Thick);
	workSheet.CellRangeBorder(1, 2, 1, 10, BorderType.BOTTOM, BorderLineValues.Thin);
	workSheet.CellRangeBorder(1, 2, 1, 10, BorderType.OUTERBOX, BorderLineValues.Thick);
	workSheet.CellRangeBorder(2, 1, 10, 1, BorderType.LEFT, BorderLineValues.Thin);
	workSheet.CellRangeBorder(2, 1, 10, 1, BorderType.OUTERBOX, BorderLineValues.Thick);
	workSheet.CellRangeAlignment(1, 2, 1, 10, VerticalCellAlignment.Center, HorizontalCellAlignment.Center);
	workSheet.CellRangeAlignment(2, 1, 10, 1, VerticalCellAlignment.Center, HorizontalCellAlignment.Center);
	workSheet.CellRangeAlignment(2, 2, 10, 10, VerticalCellAlignment.Center, HorizontalCellAlignment.Center);
}
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.3 165 11/23/2025
1.0.2 422 11/19/2025
1.0.1 843 11/16/2025
1.0.0 159 10/26/2025