ExcelRenderer.Tool 1.9.2

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global ExcelRenderer.Tool --version 1.9.2
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local ExcelRenderer.Tool --version 1.9.2
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=ExcelRenderer.Tool&version=1.9.2
                    
nuke :add-package ExcelRenderer.Tool --version 1.9.2
                    

ExcelRenderer

PDF output keeps ordinary text searchable, but supported ideographic variation sequences (IVS) are emitted as vector outlines so the selected format 14 glyph is preserved. Those outlined IVS characters are not searchable or copyable as text.

English | 日本語

Overview

ExcelRenderer is a .NET library for rendering Excel (.xlsx) worksheets as PDF documents or page-by-page PNG and SVG images.

It separates workbook parsing, layout, drawing-command generation, and output rendering into distinct stages:

Excel (.xlsx)
    -> ReportDocument
    -> RenderDocument
    -> DrawCommand
    -> PDF / PNG / SVG

This makes the rendering pipeline easier to test, understand, and extend with new layout behavior or output formats.

ExcelRenderer is currently an MVP and does not aim for pixel-perfect parity with Microsoft Excel.

Features

  • Reads .xlsx workbooks with the streaming OpenXml reader
  • Supports cell text, fonts, alignment, wrapping, fills, and borders
  • Handles merged cells, hidden rows and columns, column widths, and row heights
  • Honors print areas, page size, orientation, margins, and scaling settings
  • Splits output into pages at row and column boundaries
  • Renders worksheet PNG and JPEG images
  • Renders header and footer text
  • Produces PDF output with PDFsharp
  • Produces one PNG image per page with SkiaSharp
  • Produces one self-contained SVG per page with outlined text and embedded images
  • Exports AI-friendly Markdown with merged-cell HTML, layout-aware reading order, formulas, and external images
  • Populates XLSX templates from C# objects or JSON with the standalone mapping package
  • Recalculates a limited formula language on request; see supported syntax and 40 functions

Installation

Requirements

  • .NET 10 SDK to build and test the repository
  • A target framework compatible with .NET Standard 2.1 to consume the library
  • Appropriate fonts installed or supplied through PdfSharpFontResolver for rendering; mapping alone does not need fonts

Choose the package for your task:

Package Use it for Requirements
ExcelRenderer Render existing XLSX files to PDF, PNG, SVG or Markdown from C# .NET Standard 2.1-compatible application
ExcelRenderer.Mapping Populate XLSX templates from C# objects or JSON and save XLSX .NET Standard 2.1-compatible application; no rendering or fonts required
ExcelRenderer.Fonts Add optional bundled Japanese and emoji fonts for rendering Use alongside ExcelRenderer
ExcelRenderer.Tool Map and convert workbooks from the command line .NET 10 SDK

These are the four published NuGet packages. ExcelRenderer.Formulas and ExcelRenderer.OpenXml are separate assemblies bundled in both ExcelRenderer and ExcelRenderer.Mapping, not installable package IDs. For their APIs, install either package as shown below.

Upgrading from 1.9.0 to 1.9.1 changes public Formulas/OpenXml namespaces and breaks source and binary compatibility. Update imports and stored type names, and rebuild all dependent libraries and applications. See the migration guide for the affected types, package restore caveat and reproduced failures.

The commands below use NuGet.org and require a published version containing the feature you need. To use a feature before its package is published, see Development. The .NET Standard 2.1 libraries support applications such as .NET 8 and .NET 10; .NET Framework is not supported.

The optional ExcelRenderer.Fonts package contains Noto Sans JP Regular TTF for ordinary text, IPAmj Mincho for IVS rendering, and Noto Color Emoji. The ExcelRenderer library does not depend on that package: install it alongside the library only when you want those bundled resources and IVS fallback. Without it, the library uses explicitly registered or system fonts. The CLI depends on this package and installs it transitively. IVS rendering defaults to Gothic (IPAmj Mincho when no bundled Gothic font supports the sequence). Set FontOptions.IvsFontStyle to IvsFontStyle.Mincho, or pass --ivs-font-style mincho to the CLI, to use IPAmj Mincho directly. See third-party notices. Set FontOptions.ReplaceIvsWithBaseCharacter to true when the library should render an ideographic variation sequence as its base character without the variation selector instead of selecting its IVS glyph.

Library (NuGet)

Run this in your application's project directory (.NET Standard 2.1-compatible target required):

dotnet add package ExcelRenderer
dotnet add package ExcelRenderer.Fonts  # optional Japanese fonts

ExcelRenderer is sufficient when your application provides its own fonts. ExcelRenderer.Fonts adds only the bundled font resources; it is not required to use the library API. The package includes Noto Sans JP Regular, IPAmj Mincho, and Noto Color Emoji under their respective licenses. See third-party notices for redistribution requirements.

Template mapping library (NuGet)

To generate XLSX files without rendering, add only the mapping package:

dotnet add package ExcelRenderer.Mapping

Use ExcelTemplateMapper from the ExcelRenderer.Mapping namespace. To render the mapped workbook from C#, also add ExcelRenderer and, if needed, ExcelRenderer.Fonts. Start with the mapping guide (Japanese) for a complete template, JSON data and C# example.

Formula and low-level XLSX APIs

For in-memory formula evaluation or low-level XLSX reading/writing without rendering, install the published Mapping package:

dotnet add package ExcelRenderer.Mapping --version 1.9.1

If your application already references ExcelRenderer 1.9.1, it provides the same Formulas/OpenXml APIs; no additional package is needed. When using both main and Mapping, keep their versions aligned. Fonts are unnecessary for these APIs.

using ExcelRenderer.Formulas.Data;
using ExcelRenderer.Formulas.Evaluation;
using ExcelRenderer.Formulas.References;
using ExcelRenderer.Formulas.Syntax;
using ExcelRenderer.OpenXml.Reading;

var source = new InMemoryFormulaWorkbook.Builder().AddSheet("Invoice").Build();
var result = new FormulaEngine().Evaluate(
    FormulaParser.Parse("SUM(2,3)*4").Formula!,
    source, new FormulaCellAddress("Invoice", 1, 1));
// result.Success == true; result.Value.Number == 20

using var input = File.OpenRead("input.xlsx");
using var reader = OpenXmlWorkbookReader.Open(input);
var cells = reader.EnumerateCells(reader.SelectedWorksheetIndices[0]).ToArray();

The Formulas assembly itself uses only the BCL; the installed Mapping package also brings its XLSX and JSON dependencies. See the runnable package sample, formula guide, OpenXml guide and distribution contract.

Command-line tool (dotnet tool)

Install the .NET 10 SDK, then install the CLI from NuGet.org:

dotnet tool install --global ExcelRenderer.Tool
excelrenderer --help

The package name is ExcelRenderer.Tool; the executable command is excelrenderer. The tool includes the rendering, mapping and bundled font libraries. You do not need to install their NuGet packages separately to use the CLI. These commands assume NuGet.org is enabled in your NuGet sources.

To update an existing global installation:

dotnet tool update --global ExcelRenderer.Tool

For a project-local installation, run the following in the repository where you want to use the tool. Create the manifest only if one does not already exist:

dotnet new tool-manifest
dotnet tool install --local ExcelRenderer.Tool
dotnet tool run excelrenderer --help

Commit .config/dotnet-tools.json so other contributors can install the same tool version with dotnet tool restore.

Quick start

Convert a workbook with the CLI:

excelrenderer pdf input.xlsx -o output.pdf
excelrenderer image input.xlsx -o ./images
excelrenderer svg input.xlsx -o ./svg-output
excelrenderer md input.xlsx -o output.md

Or from C#, after adding the library:

await ExcelConverter.ConvertToPdfAsync("input.xlsx", "output.pdf");

Example output:

Japanese grid-paper report sample

See Command-line usage, C# API (high-level), and C# API (low-level) for details.

Excel template mapping

ExcelRenderer.Mapping is a standalone .NET Standard 2.1 package for mapping C# objects or JSON into XLSX templates. It supports ** cell paths, single-row arrays, nested **@start-array / **@end-array blocks, explicit CLR formatting and manual page breaks. It does not depend on rendering or font packages.

For a first example, type **Customer into cell B2 in Excel and save the workbook as template.xlsx. Create data.json in the same directory:

{ "Customer": "Alice" }

Run the CLI from that directory:

excelrenderer xlsx template.xlsx --data data.json -o report.xlsx
excelrenderer pdf template.xlsx --data data.json -o report.pdf
excelrenderer render template.xlsx --data data.json --format png -o ./png-output

report.xlsx contains Alice in B2. The xlsx command saves the mapped workbook; the other commands map it before rendering. To do the same from C#, add ExcelRenderer.Mapping and use:

using ExcelRenderer.Mapping;

ExcelTemplateMapper.Map("template.xlsx", "report.xlsx", new { Customer = "Alice" });

Property names are case-sensitive. Keep input and output paths different. See the mapping guide (Japanese) for a complete invoice example, installation, array expansion, formatting and troubleshooting.

For the complete directive list, see the specification reference. **@page-break creates breaks above and left of its cell: A10 gives a row-only break, C1 a column-only break, and C10 both. The directive cell becomes blank. See page breaks for repeated blocks and the switch from fit-to-page to scale mode.

Command-line usage

Syntax and commands

After installing ExcelRenderer.Tool, use the following syntax. input.xlsx is positional and -o is an alias for the required --output option:

excelrenderer <command> <input.xlsx> --output <path> [options]

The format-specific commands cover the common conversion cases:

excelrenderer pdf input.xlsx -o output.pdf
excelrenderer image input.xlsx -o ./images
excelrenderer svg input.xlsx -o ./svg-output
excelrenderer md input.xlsx -o output.md
Command Output Command-specific options
xlsx One mapped XLSX file --data <data.json> (required)
pdf One PDF file --sheet <name>
image One paginated PNG per worksheet page --sheet <name>, --dpi <number> (default: 144)
svg One self-contained SVG per worksheet page --sheet <name>
markdown / md One Markdown file and optional extracted images --sheet, --image-dir, --[no-]images, --[no-]cell-addresses, --[no-]formulas, --[no-]layout-detection, --[no-]region-detection
render PDF file, or a PNG/SVG/Markdown output directory --format pdf\|png\|svg\|markdown plus selection, layout, diagnostics, manifest, and font-policy options

All rendering commands also accept --data <data.json> to populate a template before conversion. Without it, they convert the existing workbook as before. See Excel template mapping for examples.

Font options

Every rendering command accepts these font-source options; xlsx does not need fonts:

Option Meaning
--font-dir <directory> Recursively search an additional directory. Repeat the option, or provide multiple values, to add directories.
--font-file <file> Register a font file directly. Repeat the option, or provide multiple values; order is significant. Supported font content includes TrueType/OpenType .ttf, .tte, and .otf files.
--fallback-font <family> Replace the default fallback-family list with the supplied families, in command-line order. Repeat it to specify a fallback chain.
--no-system-fonts Do not search operating-system font directories. Explicit files, added directories, and bundled CLI fonts remain available.
--font-policy bundled\|requested Choose whether bundled compatibility fonts (the default) or requested/explicit fonts take priority.
--ivs-font-style gothic\|mincho Choose the bundled font style used for ideographic variation sequences (default: gothic).

Font options affect glyph selection for PDF, PNG, and SVG. Markdown does not render glyphs, but accepts the same options so scripts can switch commands without changing their shared font arguments. Paths containing spaces must be quoted. For reproducible rendering in a container, for example:

excelrenderer pdf report.xlsx -o report.pdf \
  --font-dir /app/fonts \
  --font-file /app/company-fonts/ReportSans.ttf \
  --fallback-font "Noto Sans JP" \
  --fallback-font "Liberation Sans" \
  --no-system-fonts

Run excelrenderer --help to list commands and excelrenderer <command> --help for the complete, current option list.

Continuous image layout

The unified render command can generate a single continuous image per selected worksheet without print-page margins, breaks, titles, or headers:

excelrenderer render input.xlsx -o ./continuous-images --format svg --image-layout continuous

Continuous layout is available only for PNG and SVG, cannot be combined with --pages, and uses the sheet's used range rather than its print area unless an explicit range is supplied. PNG continuous output defaults to a 100 million-pixel limit (about 381 MiB for an RGBA bitmap before encoder overhead); set RenderRequest.MaxPngPixels only to a safe finite value when larger canvases are required.

Use render for range selection and content trimming:

excelrenderer render input.xlsx -o report.pdf --format pdf \
  --sheet "売上 2026" --range "'売上 2026'!B2:F40" \
  --trim --trim-padding 2 --hyperlinks preserve --manifest report.json
excelrenderer render input.xlsx -o images --format png \
  --sheet Sheet1 --range B2:F40 --image-layout continuous --trim
excelrenderer render input.xlsx -o svg --format svg --sheet Sheet1 --range B2:F40 --trim
excelrenderer render input.xlsx -o markdown --format markdown --hyperlinks preserve
Option Behavior
--range Repeat once per selected sheet. Accepts a single A1 cell or forward rectangle, $ and lowercase letters. Quote sheet names with spaces; escape an apostrophe as ''. Unqualified ranges require exactly one selected sheet.
--max-range-cells Positive total limit for explicitly selected rectangles, default 1,000,000. Includes empty cells; this is a processing limit, not a memory guarantee.
--trim Crop each already paginated page or continuous canvas around visible drawing bounds without reflowing or rescaling content.
--trim-padding Nonnegative finite padding in points, default 2; requires --trim.
--hyperlinks preserve\|none Default preserve; also available on pdf and markdown/md. none retains display text and formatting without hyperlink diagnostics, anchors or link lists.

A range replaces that sheet's print areas, preserves paper, margins, scaling and page order, and intersects repeated print titles with the selection. Ranges never select additional sheets. Entire rows/columns, unions, names, reversed ranges and external/3D references are rejected. A continuous image uses the explicit rectangle without expansion by outside objects. Partially selected merges retain their original measurement, alignment and borders and are clipped, with a ClippedMergedCell warning. --pages selects document page numbers after range pagination and before trimming. Hidden-only selections keep an empty page/canvas.

Trimming includes visible fills (including explicitly white fills), strokes, positioned text, images, shapes and headers/footers. Font glyph bounds are used where available; emoji and compatibility glyphs use conservative finalized logical bounds. This is drawing-bound cropping, not pixel-based removal of white or transparent areas inside images. An empty trimmed page remains 1×1pt plus padding (5×5pt by default), with EmptyContent information. PNG dimensions use ceiling at the requested DPI, and RenderRequest.MaxPngPixels applies to both page and continuous output before bitmap allocation.

PDF and Markdown preserve http, https, mailto and same-workbook cell links, including range references, empty source cells, simple scoped A1 names, and literal-string HYPERLINK formulas. Explicit XML definitions take precedence over formulas. Only saved displays are used; uncached formulas display empty text and report FormulaCachedValueMissing. PDF annotations are attached to the final merged document and follow page selection and trimming. Markdown uses stable xl-sN-rN-cN anchors and explicit target/source lists where a blank cell or source range cannot carry a natural label. PNG and SVG retain cell appearance without clickable links or hyperlink warnings. SVG links and link sidecars are not generated.

Unsafe URIs (including local files, relative paths, UNC, embedded HTTP credentials, control characters and unsupported schemes), conflicting definitions and unsupported dynamic formulas retain display text and yield HyperlinkRejected/HyperlinkUnsupported warnings. Missing or omitted internal destinations yield HyperlinkTargetOmitted; excluded sources do not produce destination warnings. Diagnostics omit URI/recipient/query contents. Readable invalid link definitions are warnings; corrupt packages and missing hyperlink relationships are fatal input errors. Strict mode or matching --warnings-as-errors stops output before the sink opens. The PDF CLI creates/truncates its file only after preflight; identical input/output paths are rejected before reading.

The stream API exposes the same options without changing existing positional constructors:

var request = new RenderRequest
{
    OutputFormat = OutputFormat.Pdf,
    Selection = new SelectionOptions
    {
        SheetNames = new[] { "Sheet1" },
        Ranges = new[] { new SheetRangeSelection("Sheet1", new CellRange(new(2, 2), new(40, 6))) },
        MaxRangeCells = 1_000_000,
    },
    Trim = new TrimOptions { Enabled = true, PaddingPoints = 2 },
    Hyperlinks = HyperlinkMode.Preserve,
};

Import ExcelRenderer.Rendering and ExcelRenderer.Model for these settings. PDF/Markdown legacy options also expose Hyperlinks. Markdown rejects ranges, trimming and page selection before output. With no ranges or trim, page dimensions and existing layout stay unchanged. Schema-version-1 manifests add optional page/range/crop metadata: widths/heights describe final output, while original dimensions and crop coordinates describe the page before trim. Missing range means existing print/used-range selection; missing crop/padding means identity translation. No link targets or full tooltips are listed in manifests.

C# API (high-level)

After installing ExcelRenderer, the facade API performs the complete read, layout, render, and write pipeline:

using ExcelRenderer;

await ExcelConverter.ConvertToPdfAsync("input.xlsx", "output.pdf");
await ExcelConverter.ConvertToImagesAsync("input.xlsx", "./images");
await ExcelConverter.ConvertToSvgAsync("input.xlsx", "./svg-output");
await ExcelConverter.ConvertToMarkdownAsync("input.xlsx", "output.md");

For stream-based integrations, RenderAsync reads from the input's current position and leaves both the input stream and a SingleStreamOutputSink output stream open. Use DirectoryOutputSink for page-by-page PNG/SVG output. RenderRequest selects sheets by exact name (in request order) and can select rendered PDF/PNG/SVG document pages; Markdown does not support page selection. ConversionManifest.WriteAsync writes the completed artifact metadata and diagnostics as schema version 1 JSON with relative artifact names.

PDF export skips images when Skia cannot create a codec or decode a bitmap, and reports ImageDecodeFailed warnings. Diagnostics include the sheet, source page, image bounds, byte length, up to 16 header bytes, and the decode failure reason. The render command prints warnings to stderr; use --manifest report.json to save these details as JSON. Strict mode or treating ImageDecodeFailed as an error stops conversion instead. Low-level PdfSharpRenderer callers can receive warnings through DiagnosticHandler; warnings are also written to System.Diagnostics.Trace listeners.

Use PdfExportOptions, ImageExportOptions, SvgExportOptions, and MarkdownExportOptions to select a worksheet or configure format-specific behavior. Existing output files, and non-empty image or SVG output directories, are not overwritten.

C# API (low-level)

Install the ExcelRenderer package or reference the project, then run the workbook through the layout and rendering pipeline:

using ExcelRenderer.Drawing;
using ExcelRenderer.Excel;
using ExcelRenderer.Layout;
using ExcelRenderer.PdfSharp;

var document = new ExcelReader().Read("report.xlsx");
var sheet = document.Sheets[0];

var layoutEngine = new ReportLayoutEngine(new PdfSharpTextMeasurer());
var renderDocument = layoutEngine.Layout(sheet);
var commands = new DrawCommandGeneratorPass().Generate(renderDocument);

using var output = File.Create("report.pdf");
new PdfSharpRenderer().Render(commands, sheet.PageSettings, output);

ExcelReader preserves whether an xlsx uses an explicit percentage or Fit-to-pages in PageSettings.ScaleMode. Fit-to-pages never enlarges content beyond 100%. When constructing PageSettings directly, leaving ScaleMode unset preserves the legacy rule that a positive Scale wins; opt in explicitly when a fit count must override the positional default scale:

var settings = new PageSettings(FitToPagesWide: 1)
{
    ScaleMode = PrintScaleMode.FitToPages,
};

For xlsx input, explicit and default raw column widths are converted at the fixed Excel reference DPI of 96; output PNG DPI does not change sheet geometry. The Normal style is resolved through its style XF and theme major/minor font before measuring digits 0–9 with the configured font manager. If that font cannot be measured, a 7px compatibility width is used and MaximumDigitWidthFallback is reported through conversion diagnostics.

Distinct print areas are paginated independently without filling their bounding rectangle. Explicit-scale output honors saved row and column page breaks and the worksheet page order; Fit-to-pages ignores manual breaks. The combined pages are renumbered once across all areas, so page fields and PDF/PNG/SVG page selection use the same sequence. Objects intersecting more than one page are placed from the same source geometry on each page and clipped to that page's body viewport rather than merely to the physical paper. Saved horizontal and vertical centering moves cells, objects, and their body clip together; continuous output intentionally ignores print setup. Cell indentation, content padding, ordinary rotation, and stacked top-to-bottom text are carried into PDF, PNG, and SVG drawing.

Wrapped cell text is finalized during layout into lines and resolved font runs, including grapheme-safe forced breaks and explicit-newline markers. The result is carried by the draw command. PDF, PNG, and SVG consume the finalized effective font size, per-line baseline and height, selected run font, and logical run X/advance instead of independently wrapping, shrinking, or advancing the text. Commands created directly without a TextLayout retain the legacy renderer-side compatibility path. On that compatibility path, PNG and SVG select one Skia system face from the requested family, weight, and slant and retain that same face for measurement, wrapping, shrinking, and drawing.

TextLayoutResult.EffectiveFontSize preserves a compatibility distinction: results created with the original two-argument constructor use the command style size, while an explicitly assigned zero suppresses drawing. PDF and Skia reuse the physical face selected for each finalized run, including memory-backed faces. Finalized underlines are drawn once from the stored line origin, baseline, and width; PDF font decoration is disabled on that path so it cannot produce a second underline.

DrawingML picture metadata preserves and resolves one-cell, two-cell, and absolute anchors in points together with marker offsets, extents, editAs, source crop, rotation, flips, and worksheet drawing order. Source crop is applied by both renderer backends without changing the destination bounds.

To render the same commands as page-by-page PNG files:

using ExcelRenderer.SkiaSharp;

new PngRenderer().Render(
    commands,
    sheet.PageSettings,
    pageNumber => File.Create($"report-{pageNumber}.png"),
    dpi: 144);

To render one self-contained SVG file per page, with dimensions and coordinates in PDF points:

new SvgRenderer().Render(
    commands,
    sheet.PageSettings,
    pageNumber => File.Create($"report-{pageNumber}.svg"));

SVG text is converted to vector paths so the viewer does not need the source font. This intentionally prevents text search and copy; it does not prevent editing. Raster images are embedded in each SVG. Text shaping has the same limitations as PNG rendering, and complex scripts or color/bitmap-only glyphs are not guaranteed.

To convert an entire workbook to Markdown and extract its images:

using ExcelRenderer.Markdown;

await ExcelMarkdownConverter.ConvertAsync("sample.xlsx", "output");

This creates output/sample.md and image files under output/images. Use MarkdownExportOptions to control formula/address metadata, hidden rows and columns, nearby image text, layout analysis, and image export. Markdown export consumes the same ReportDocument model as the renderers and does not alter the PDF/PNG pipeline.

Partial cell formatting and optional diagnostics

PDF, PNG and SVG preserve partial font family, size, bold, italic, color and single underline in ordinary string cells. ReportCell.RichTextRuns contains effective CellTextRun values; Text remains the complete plain string. Manual models must supply matching text and valid positive sizes. The built-in measurer implements IRichTextLayoutService; existing custom measurers keep working with a cell-font fallback. Core-only output keeps its single regular font. Markdown stays plain text.

Partial formatting with rotated/vertical cell text falls back to the cell font. Strikethrough, superscript/subscript, double/accounting underlines and phonetics are not rendered. Enable additional detection to report unsupported partial formatting and conditional formatting. Anchored chart diagnostics retain the existing UnsupportedDrawingObject code and are filtered during selected-page preflight when additional detection is enabled. No chart or conditional-format rendering is added.

excelrenderer render input.xlsx -o output.pdf --format pdf \
  --layout-warnings --min-readable-font-size 6 --detect-unsupported-features

DiagnosticOptions.EnableLayoutWarnings defaults to false. MinimumReadableFontSize defaults to 6pt and must be finite and positive; setting it alone does not enable warnings. The CLI requires --layout-warnings with --min-readable-font-size. CellTextClipped checks finalized logical line placement for horizontal wrapped/shrunk cells with a 0.25pt tolerance, not complete glyph ink bounds. CellTextTooSmall uses final scaled visible run sizes. These warnings do not resize cells and are not emitted for Markdown. New warnings run in preflight; diagnostic failure occurs before opening output sinks.

With DetectUnsupportedFeatures, chart sheets are reported at sheet level with unknown cell position using UnsupportedDrawingObject; they add no blank output page. Selecting only chart sheets returns diagnostics and no artifacts. RenderRequest.TextMeasurer can supply a caller-owned legacy service. Without IRichTextLayoutService, rich cells use the cell font and emit opt-in RichTextLayoutFallback in preflight. The built-in service remains the default. No additional glyph measurement is done just for diagnostics.

Workbook reading and formula results

Reader and Mapping always use OpenXml. See workbook APIs, CLI usage, supported scope and stream guarantees. Existing callers can follow the engine-selection migration. ExcelRenderer.OpenXml provides the shared reader, writer and input handling; ClosedXML has been removed from the libraries, CLI, tests and tools. The Reader style API has changed to ExcelStyleConverter.Convert(CellStyleInfo, CellValueType); see breaking changes and migration. Low-level APIs are documented in the OpenXml reader reference.

Formula display defaults to FormulaDisplayMode.CachedValue in Core, the main Reader, export APIs and CLI (--formula-mode cached). Saved results may be stale; missing caches produce FormulaCachedValueMissing. Opt in to the limited built-in calculator with FormulaDisplayMode.Recalculate or --formula-mode recalculate. The independent BCL-only engine supports 40 functions and strict diagnostics; unsupported reached formulas never fall back to saved results. Legacy remains unsupported. The formula support reference lists every function with argument counts and examples, supported syntax, errors and limits. See formula calculation for API examples, selected source scope, cache invalidation, compatibility limits and validation.

Default Mapping rejects value formulas; explicit MappingOptions.FormulaCalculationMode = Recalculate enables supported formulas with AST-based row-reference rewriting and recalculation. Mapped strings beginning with = remain strings. See the Mapping guide.

Fonts

When loading the optional bundled fonts, ExcelRenderer looks for each expected file name (NotoSansJP-Regular.ttf, ipamjm.ttf, and NotoColorEmoji.ttf) in this order:

  1. Embedded resources in *.dll files directly beside ExcelRenderer.dll. A resource name must equal the font file name or end with . plus that name. DLLs are checked in ordinal path order; DLLs that cannot be loaded or inspected are skipped.
  2. Loose files with the exact font file name anywhere in the directory containing ExcelRenderer.dll or its subdirectories. If several match, the first path in ordinal order is used.

An embedded resource takes precedence over a loose file. The DLL search is not recursive; only the loose-file search includes subdirectories.

using ExcelRenderer.PdfSharp;
using PdfSharp.Fonts;

GlobalFontSettings.FontResolver = new PdfSharpFontResolver(
    "Noto Sans JP",
    "/app/fonts/NotoSansJP-Regular.ttf");

All commands accept the font options described above. --font-file reads each font directly and registers its internal family and style; supported TrueType/OpenType content can therefore be supplied as .ttf, Windows EUDC .tte, or .otf without relying on its extension. For example: --font-file /app/fonts/report.ttf --font-file C:\Windows\Fonts\EUDC.TTE. For BMP private-use characters (U+E000–U+F8FF), the requested font is tried first, followed by these files in command-line order and then normal family fallbacks. If none contains the glyph, MissingPrivateUseGlyph is reported and U+FFFD is rendered; --strict and --warnings-as-errors MissingPrivateUseGlyph can make this a conversion failure. Font files must be readable and valid, and users are responsible for their licenses and PDF embedding rights. The option has no effect on Markdown output because Markdown does not render glyphs. bundled is the default for compatibility; requested prioritizes registered and supplied font directories before configured fallbacks and the bundled font. Font fallback is selected per Unicode text element, so surrogate pairs and combining sequences are not split.

Architecture

Resolved PDF fonts use immutable snapshots. A conversion owns its font resources; finalized public layouts retain the snapshots they need. Global resolver registrations use weak references and are cleaned after each conversion.

For the PDF-only source project (no separate NuGet package), see ExcelRenderer Core.

The main package includes ExcelRenderer.Core.dll from the same build; Core is also available as a source ProjectReference. Basic reading, geometry/page layout, drawing and PDF operations are shared; advanced features remain in the main library. See the shared Core architecture and verification results.

ExcelRenderer converts a workbook to ReportDocument, RenderDocument, and DrawCommand, then renders PDF, PNG, or SVG.

Excel (.xlsx) -> ReportDocument -> RenderDocument -> DrawCommand -> PDF / PNG / SVG

See Architecture for the layout passes, drawing commands, renderers, extension points, and source layout.

Current limitations

  • Charts are not supported.
  • Formula display uses saved results by default; explicit recalculation supports the documented syntax and 40 functions. Full Excel calculation compatibility is not guaranteed.
  • Conditional formatting is not rendered.
  • Not every paper size or header/footer formatting code is supported.
  • Page breaks occur only at row and column boundaries.
  • Japanese top-to-bottom mode stacks Unicode text elements; it does not yet select full typographic vertical glyph variants or reproduce every Japanese line-breaking rule.
  • Drawing anchors are resolved on print-area-independent sheet geometry. XML row/column overrides outside the used and print ranges are retained, and hidden rows/columns occupy 0 pt. The latter anchor behavior has not been verified against desktop Excel. Repeated titles do not repeat drawing objects.
  • Output can differ from Excel because font measurement and rendering engines differ.

PDF performance

The stream converter draws all pages directly into one PDF document and saves once. Native font faces, line metrics and PDF fonts are reused within each conversion; native faces are disposed on success, cancellation and failure. Unused Skia font strikes are purged at conversion end to release retained native font data. Text caches are bounded. Sparse sheet coordinates, page candidates and merged-cell queries use indices, and equal converted styles share immutable values. Styled blank cells remain part of the model.

The converter plans page bands first, selects pages in document order, and preflights all selected output dimensions, trimming and links before opening any output sink. It then generates and writes one page at a time. Paginated output uses two page passes; public ReportLayoutEngine.Layout remains a materializing compatibility API. Continuous PNG/SVG rescans cells by drawing layer, preserving backgrounds, borders, text and object order without keeping all commands. Markdown retains its existing path.

Selected-sheet body models and drawing-range projection reduce retained models. OS and additional-directory font scans retain metadata; a physical face's bytes and SHA256 identity are loaded once when first selected. Explicit font files and registrations are validated and snapshotted immediately. Optional font-pack data is also loaded on demand. An OS font is not a complete snapshot until its first selection; a file that changes or disappears before that read raises a font load error. PDFsharp's process-wide resolved font-byte cache remains in place.

PDFsharp still retains its final document and resources until the single save. The OpenXml Reader retains source styles and shared strings. Layout geometry and selected models also scale with workbook size. This is not constant-memory streaming. See the phase 3 measurements and the historical PDF and image reports.

PNG and SVG performance and buffering

PNG encoding uses the existing bitmap pixels. Page output keeps one bitmap at a time; continuous PNG remains one worksheet per PNG with one full bitmap, not scanline or tiled encoding. Its RGBA pixels require approximately 4 × width × height bytes plus alignment and encoder overhead. Both PNG APIs validate dimensions and enforce their pixel limit. A conversion-local image cache estimates decoded resource memory and uses a 64 MiB LRU budget; an image exceeding that budget is owned only during its active draw. PDFsharp's own retained document image resources are additional to that estimate.

SVG keeps Skia's SVG canvas and streaming XML normalization (outlined text, embedded images, point dimensions, and viewBox). Its seekable intermediate buffer spills before exceeding the configured memory capacity. Skia may also buffer native SVG data, so the stream threshold does not bound the whole conversion's memory.

RenderRequest.Buffering, SvgExportOptions.Buffering, and overloads of SvgRenderer.Render, RenderPage, and RenderCanvas accept RenderBufferOptions:

Property Default Meaning
MemoryThresholdBytes 8,388,608 Maximum intermediate memory capacity in bytes.
AllowTemporaryFiles true Spill once to a temporary file above the threshold; when false, reject excess data.
TemporaryDirectory null System temp directory, or the specified existing directory.

The render and svg CLI commands expose --buffer-memory-threshold (bytes), --no-buffer-temp, and --buffer-temp-directory:

excelrenderer render input.xlsx -o ./svg --format svg --buffer-memory-threshold 8388608
excelrenderer svg input.xlsx -o ./svg --buffer-memory-threshold 1048576 --buffer-temp-directory ./existing-temp

These options affect only the SVG intermediate stream, even when passed with PDF/PNG. They are independent of WorkbookInputOptions: input buffering now spools to a seekable temporary file when its own threshold is exceeded and temporary files are allowed. Readers use independent cursors without converting the spool back to a byte array. Temporary buffers are cleaned up on success, cancellation, and failures; caller-owned input and output streams stay open. Heavy native drawing and encoding operations cannot be interrupted immediately.

Development

The Formulas/OpenXml API namespaces now follow their source folders. See the namespace migration guide for updated imports and public type locations.

NuGet publication is limited to ExcelRenderer, ExcelRenderer.Mapping, ExcelRenderer.Tool and ExcelRenderer.Fonts. Core, OpenXml and Formulas are source projects whose assemblies ship inside those packages; they are not published separately. See package distribution.

To try the CLI from source before publishing, create and install a local package:

dotnet pack src/ExcelRenderer/ExcelRenderer.csproj -c Release -o artifacts/packages
dotnet pack src/ExcelRenderer.Mapping/ExcelRenderer.Mapping.csproj -c Release -o artifacts/packages
dotnet pack src/ExcelRenderer.Fonts/ExcelRenderer.Fonts.csproj -c Release -o artifacts/packages
dotnet pack src/ExcelRenderer.Tool/ExcelRenderer.Tool.csproj -c Release -o artifacts/packages
dotnet tool install --tool-path ./artifacts/tool-test --add-source ./artifacts/packages ExcelRenderer.Tool
./artifacts/tool-test/excelrenderer --help

Run the test suite from the repository root:

dotnet test ExcelRenderer.slnx

Projects are under src/, and their corresponding test projects are under tests/. To try the mapping library from a local package, register the built package directory alongside NuGet.org, then add the package in your application project:

dotnet nuget add source <absolute-path-to-artifacts/packages> --name ExcelRendererLocal
dotnet add package ExcelRenderer.Mapping

Replace the placeholder with the actual directory path. Skip source registration if it is already configured. Keep NuGet.org enabled for dependencies such as DocumentFormat.OpenXml.

Documentation

Topic Guide
Workbook reading/mapping, formula results, CLI and stream contracts OpenXml integration (日本語)
Formula syntax, supported functions, coercion, errors and limits Formula support reference (日本語)
Explicit recalculation, typed caches and saving APIs Formula calculation (日本語)
Template syntax, calculated input values and examples Mapping (日本語)
PDF-only source API and font requirements Core (日本語)
Source records, formatting and low-level reader limits OpenXml reader (日本語)
Rendering stages and extension points Architecture (日本語)
Shared implementation and product boundaries Core architecture (日本語), source ownership
Test, package, allocation and CI evidence by commit Validation record

Validation reports record behavior at their stated commits. Use the guides above for current APIs and supported behavior. Repository contributors should also read the AI coding agent guide.

License

ExcelRenderer is available under the MIT License.

The optional ExcelRenderer.Fonts package contains the Japanese fonts and their separate license texts; see Third-party notices.

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.

This package has no dependencies.

Version Downloads Last Updated
1.11.2 109 11/16/2026
1.11.1 107 11/15/2026
1.11.0 115 11/14/2026
1.10.5 104 11/11/2026
1.10.4 131 10/22/2026
1.10.3 113 10/21/2026
1.10.2 114 10/20/2026
1.10.1 116 10/19/2026
1.10.0 122 10/18/2026
1.9.2 120 10/17/2026
1.9.1 122 10/17/2026
1.9.0 111 10/16/2026
1.8.0 110 10/9/2026
1.7.2 125 10/7/2026
1.7.1 125 10/7/2026
1.7.0 122 10/7/2026
1.6.10 124 10/5/2026
1.6.9 124 10/4/2026
1.6.8 130 10/4/2026
1.6.7 127 10/3/2026
Loading failed