FluentExcelService 1.3.0

dotnet add package FluentExcelService --version 1.3.0
                    
NuGet\Install-Package FluentExcelService -Version 1.3.0
                    
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="FluentExcelService" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FluentExcelService" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="FluentExcelService" />
                    
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 FluentExcelService --version 1.3.0
                    
#r "nuget: FluentExcelService, 1.3.0"
                    
#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 FluentExcelService@1.3.0
                    
#: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=FluentExcelService&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=FluentExcelService&version=1.3.0
                    
Install as a Cake Tool

ExcelService

  • A Fluent Interface for OpenXML with Dynamic Object XLSX Creation and Modification.
  • Includes Styling based on query or based on location, using base Open XML properties
  • Fast Quick Table Creation and Modification Without DataTable use

Installation

Dotnet CLI

dotnet add package FluentExcelService --version 1.3.0

Package Manager

NuGet\Install-Package FluentExcelService -Version 1.3.0

Usage

Locally Saving a File

Excel excel = new Excel();

excel.GenerateNewWorkBook(new List<TestClass>()
{
    new TestClass("a", "b", "c", "d", "e", "f", "g", 1, new DateTime(1999, 12, 08)),
    new TestClass("h", "i", "j", "k", "l", "m", "m", 2, new DateTime(1998, 11, 07)),
    new TestClass("n", "l", "o", "p", "q", "r", "s", 2, new DateTime(1998, 11, 07)),
},
new List<List<Style>>()
{ 
    new List<Style>()
    { 
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
    },
    new List<Style>()
    {
        new Style(Enums.Font.Calibri, Color.Red, 8),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        new Style(Enums.Font.Calibri, Color.Red, 8),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
    },
    new List<Style>()
    {
        new Style(Enums.Font.Calibri, Color.Pink, 8),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        new Style(Enums.Font.Arial, Color.Green, 20),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
    },
    new List<Style>()
    {
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
        new Style(Enums.Font.Arial, Color.Red, 25),
        new Style(Enums.Font.Arial, Color.Yellow, 48),
        Style.Empty(),
        Style.Empty(),
        Style.Empty(),
    },
},
"TestWorkbook",
"TestSheet");

excel["TestWorkbook"]?.StyleRowWhere<TestClass>(x => x.Column1 == "a", new Style(Enums.Font.Arial, Color.Green, 65));

excel["TestWorkbook"]?.StyleRowWhere<TestClass>(x => x.Column1 == "n", new Style(Enums.Font.Arial, Color.Red, 25));

excel["TestWorkbook"]?.StyleCellWhere<TestClass>(x => x.Column2 == "b", new Style(Enums.Font.Calibri, Color.Aqua, 30));

excel.SaveExcelFileFromWorkbook("../../../test.xlsx", excel["TestWorkbook"] ?? throw new NullReferenceException("Invalid Container"));

Getting a Workbook From a File


Excel excel = new Excel();

Workbook workbook = excel.GetWorkbookFromExcelFile("../../../test.xlsx");


Dependency Injections

//Add Interface and Class as normal... for azure as example:
services.AddScoped<IExcel, Excel>();

//-----------------------------

public class MyDependencyInjectableClass
{
    private readonly _excel;
    public MyDependencyInjectableClass(IExcel excel)
    {
        _excel = excel;
    }

    public void Foo()
    {
        _excel..... methods
    }
}

Saving Stream to a File


_excel.GenerateNewWorkBook(Workbook.GetWorkbookFromDataSet(myEnumerableOfObjects, null, "A WorkSheet Name", "A sheet"));
_excel.GenerateNewWorkBook(Workbook.GetWorkbookFromDataSet(myOtherEnumerableOfObjects, null, "A Second WorkSheet Name", "A sheet"));

_excel["A WorkSheet Name"]!.StyleRowWhere(x => x.MyParameter == "a really cool parameter")

_excel.CombineWorkbooks(_excel["A WorkSheet Name"]!, _excel["A Second WorkSheet Name"]!);
Stream myOtherStream = _excel.GetExcelFromWorkBook(_excel["DARTContainersNotTrackingInCavi"]!);
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.3.0 357 3/23/2023
1.2.1 322 3/23/2023
1.2.0 342 3/17/2023
1.1.0 359 2/19/2023
1.0.1 371 2/10/2023
1.0.0 606 2/10/2023