PayrollEngine.Document 0.10.0-beta.1

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

Payroll Engine Document

Part of the Payroll Engine open-source payroll automation framework. Full documentation at payrollengine.org.

Document library for the Payroll Engine, providing data transformation for exchange and reporting. Supports PDF generation via FastReport templates and Excel export via NPOI.

Features

  • PDF Generation — Merge DataSet with FastReport templates (.frx) to produce PDF documents with metadata (author, title, keywords)
  • Excel Export — Convert DataSet tables to .xlsx workbooks with auto-sized columns, header filters, and correct cell typing (numeric, boolean, date)
  • Template Parameters — Pass custom key-value parameters into FastReport templates
  • Document Metadata — Apply metadata (author, title, subject, keywords) to generated documents

NuGet Package

Available on NuGet.org:

dotnet add package PayrollEngine.Document

Quick Start

PDF Generation from FastReport Template

using PayrollEngine.Document;

var dataMerge = new DataMerge();

// load your FastReport template (.frx)
using var templateStream = File.OpenRead("report-template.frx");

// prepare your data
var dataSet = new DataSet();
// ... populate tables ...

// define document metadata
var metadata = new DocumentMetadata
{
    Title = "Payroll Report Q1 2026",
    Author = "Payroll Engine",
    Application = "PayrollEngine.Document",
    Keywords = "payroll, report"
};

// optional: template parameters
var parameters = new Dictionary<string, object>
{
    ["CompanyName"] = "Acme Corp",
    ["ReportDate"] = DateTime.Now
};

// generate PDF
using var pdfStream = dataMerge.Merge(
    templateStream, dataSet, DocumentType.Pdf, metadata, parameters);

// save to file
await using var fileStream = File.Create("report.pdf");
await pdfStream.CopyToAsync(fileStream);

Excel Export

using PayrollEngine.Document;

var dataMerge = new DataMerge();

var dataSet = new DataSet();
// ... populate tables (each DataTable becomes a worksheet) ...

var metadata = new DocumentMetadata
{
    Title = "Payroll Data Export"
};

// generate Excel workbook
using var excelStream = dataMerge.ExcelMerge(dataSet, metadata);

// save to file
await using var fileStream = File.Create("export.xlsx");
await excelStream.CopyToAsync(fileStream);

Check Supported Document Types

var dataMerge = new DataMerge();
bool canMergePdf   = dataMerge.IsMergeable(DocumentType.Pdf);    // true
bool canMergeExcel = dataMerge.IsMergeable(DocumentType.Excel);  // true

API Reference

IDataMerge

The interface implemented by DataMerge, providing the contract for document generation.

DataMerge

The main entry point implementing IDataMerge.

Method Return Description
IsMergeable(DocumentType) bool Returns true for Excel and Pdf
Merge(Stream, DataSet, DocumentType, DocumentMetadata, IDictionary?) MemoryStream Merges a FastReport template with data; produces PDF or delegates to ExcelMerge
ExcelMerge(DataSet, DocumentMetadata, IDictionary?) MemoryStream Exports a DataSet to an .xlsx workbook <sup>1)</sup>

<sup>1)</sup> The parameters argument of ExcelMerge is part of the interface signature but is not applied during Excel export — Excel workbooks have no template parameter concept.

DocumentMetadata

Applied to generated documents. Fields and their PDF mapping:

Property PDF property Description
Title Title Document title
Author Author Document author
Application Subject Originating application name
Keywords Keywords Search keywords

Extension Methods

Class Method Description
CellExtensions SetValue(ICell, object) Sets an Excel cell value with correct type mapping
WorkbookExtensions Import(IWorkbook, DataSet) Imports all DataTables as named worksheets; tables with no columns are skipped
PDFSimpleExportExtensions ApplyMetadata(PDFSimpleExport, DocumentMetadata) Applies DocumentMetadata to a PDFSimpleExport instance

Type Mapping (Excel)

.NET Type Excel cell type
double, float, decimal, int, long, short, byte Numeric
bool Boolean
DateTime String — yyyy-MM-dd HH:mm:ss
DateOnly String — yyyy-MM-dd
null, DBNull Blank
All others String (ToString())

FastReport

Reports are based on FastReport Open Source:


Build

dotnet build
dotnet pack

Environment variable used during build:

Variable Description
PayrollEnginePackageDir Output directory for the NuGet package (optional)

Third Party Components

Component Purpose License
NPOI Excel export Apache 2.0
FastReport Open Source Report engine and PDF export MIT

See Also

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
0.10.0-beta.1 38 3/9/2026
0.9.0-beta.17 64 2/18/2026
0.9.0-beta.16 54 2/11/2026
0.9.0-beta.15 54 2/5/2026
0.9.0-beta.14 67 1/14/2026
0.9.0-beta.13 63 1/7/2026
0.9.0-beta.12 180 11/5/2025
0.9.0-beta.11 202 10/13/2025
0.9.0-beta.10 225 9/14/2025
0.9.0-beta.9 197 8/26/2025
0.9.0-beta.8 278 8/25/2025
0.9.0-beta.7 149 8/11/2025
0.9.0-beta.6 181 3/27/2025
0.9.0-beta.5 103 3/14/2025
0.9.0-beta.4 157 3/12/2025
0.9.0-beta.3 101 2/25/2025
0.9.0-beta.1 106 2/12/2025
0.8.0-beta.2 129 7/10/2024
0.8.0-beta.1 220 11/27/2023
0.6.0-beta.11 125 10/10/2023
Loading failed