DocuChef 0.5.0

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

DocuChef

The Master Chef for Document Templates - Cook delicious documents with your data and templates.

DocuChef Overview

Overview

DocuChef provides a unified interface for document generation across multiple formats. It supports Excel document generation using ClosedXML.Report.XLCustom, PowerPoint document generation using DollarSignEngine, and Word document generation with variable binding, table/paragraph repetition, and image insertion.

In the spirit of its culinary name, DocuChef offers both standard API methods and fun cooking-themed extension methods that make template processing feel like preparing a delicious dish!

Current Features

  • Excel Template Processing: Generate Excel documents from templates using ClosedXML.Report.XLCustom
  • PowerPoint Template Processing: Generate PowerPoint presentations from templates with embedded variables and functions
  • Flexible Variable Binding: Add variables, complex objects, collections to your templates
  • Global Variables: Access system information and date/time within your templates
  • Custom Function Support: Register custom functions for Excel cell processing and PowerPoint shape processing
  • Error Handling: Clear error reporting with specialized exception types
  • Culinary API Theme: Optional cooking-themed extension methods for a more enjoyable API experience
  • Consistent Document Interface: All document types implement the IDish interface for unified handling
  • Word Template Processing: Generate Word documents from templates with variable binding, table/paragraph repetition, and image insertion
  • Unresolved Variable Reporting: IDish.UnresolvedVariables lists template expressions that failed to resolve during generation (PowerPoint and Word; always empty for Excel, a current limitation of the underlying ClosedXML.Report engine)
  • Configurable Logging: RecipeOptions.LoggerFactory routes DocuChef's internal diagnostics through your own Microsoft.Extensions.Logging pipeline instead of the console/debug output

Planned Features

  • Additional built-in functions for Excel and PowerPoint templates
  • Enhanced PowerPoint chart and table functionality
  • Enhanced formatting options

Documentation

Installation

Install-Package DocuChef

Or via .NET CLI:

dotnet add package DocuChef

Quick Start

Standard API Usage

// Create document processor
var chef = new Chef();

// Load your template (Excel or PowerPoint)
var recipe = chef.LoadTemplate("template.xlsx"); // or "template.pptx" or "template.docx"

// Add your data
recipe.AddVariable("Title", "Sales Report");
recipe.AddVariable("Products", productList);
recipe.AddVariable("Date", DateTime.Now);

// Generate and save the document
recipe.Cook("result.xlsx"); // or "result.pptx" or "result.docx"

Culinary-themed API

// Create document processor
var chef = new Chef();

// Load your recipe (template)
var recipe = chef.LoadRecipe("template.xlsx"); // or "template.pptx" or "template.docx"

// Add ingredients (variables)
recipe.AddIngredient("Title", "Sales Report");
recipe.AddIngredients(productData); // Add all properties from an object

// Cook the document and serve it
var dish = recipe.CookDish();
dish.Serve("result.xlsx"); // or "result.pptx" or "result.docx"

// Optionally, present the dish to the user
dish.Present(); // Opens in default application

One-step Document Generation

// Create document processor
var chef = new Chef();

// Prepare a dish directly from a template and data
chef.PrepareDish("template.xlsx", salesData, "result.xlsx");

Working with Excel Templates

Excel-specific Features

// Load Excel template
var recipe = chef.LoadTemplate("template.xlsx");

// Register custom functions for Excel processing
recipe.RegisterFunction("FormatCurrency", (cell, value, parameters) => {
    if (value is decimal amount)
    {
        cell.Style.NumberFormat.Format = "$#,##0.00";
        return amount;
    }
    return value;
});

// Or using the culinary API
recipe.RegisterTechnique("FormatCurrency", (cell, value, parameters) => {
    // Same implementation
});

recipe.Cook("result.xlsx");

Binding a List (Repeating Rows)

To expand a list into one row per item, define a named range in the template that covers the data row plus one extra column to its left and one extra row below it (a service column and a service row — required by the underlying ClosedXML.Report engine). Name the range after the variable you bind, and reference the current item with the fixed item keyword — not the range name itself:

// Template: named range "Products" spanning A1:C2 (A = service column, row 2 = service row)
//   B1: {{item.Name}}   C1: {{item.Price}}
var recipe = chef.LoadTemplate("template.xlsx");
recipe.AddVariable("Products", productList); // one row is generated per item in productList
recipe.Cook("result.xlsx");

Working with PowerPoint Templates

PowerPoint Features

// Load PowerPoint template
var recipe = chef.LoadTemplate("template.pptx");

var categories = new List<Category>();
recipe.AddVariable("Categories", categories);
// recipe.AddVariable(data);

// Generate the presentation
recipe.Cook("result.pptx");

Known Limitations

Word: Nested #foreach not supported

ParagraphRepeater and TableRepeater process only the outermost #foreach block. Nested blocks are silently skipped or produce incorrect output:

{{#foreach items}}
  {{#foreach item.subItems}}   ← NOT processed
    {{subItem.Name}}
  {{/foreach}}
{{/foreach}}

Workaround: Flatten the data before binding (pre-process nested collections into a flat list).

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 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 (1)

Showing the top 1 NuGet packages that depend on DocuChef:

Package Downloads
Iyu.Report

iyu-framework-v5: OData + GraphQL runtime framework for .NET 10.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.5.0 213 8/25/2026
0.4.0 141 8/24/2026
0.3.0 110 8/18/2026
0.2.3 115 8/1/2026
0.2.1 142 5/19/2026
0.2.0 127 3/18/2026
0.1.1 419 6/10/2025
0.1.0 268 6/2/2025