KCellReport 0.14.1

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

CellReport

CellReport — кроссплатформенный фреймворк для создания, просмотра и экспорта табличных отчётов. Шаблоны описываются в XML (.tcr, .tcrp), данные подставляются через API секций и параметров, результат выводится на экран или экспортируется в Excel, PDF, HTML и PNG.

Поддерживаемые UI-стеки: WinForms, WPF, Avalonia. Ядро таргетит net10.0 и net48.

NuGet-пакеты

Пакет Назначение
KCellReport Ядро: шаблоны, ReportDocument, экспорт, Skia-рендерер
KCellReport.WinForms Просмотр и печать в WinForms
KCellReport.Avalonia MVVM-компоненты для Avalonia 12

Структура репозитория

CellReport/
├── src/
│   ├── CellReport/                 # ядро
│   ├── CellReport.WinForms/        # WinForms UI
│   ├── CellReport.WPF/             # WPF UI
│   ├── CellReport.Avalonia/        # Avalonia UI
│   ├── CellReport.Editor/          # редактор шаблонов (WPF)
│   ├── CellReport.Viewer/          # WinForms viewer
│   └── CellReport.Avalonia.Viewer/ # Avalonia viewer
├── Tests/                          # автоматические тесты (MSTest)
└── CellReport.sln

Быстрый старт

git clone https://github.com/sndanil/CellReport.git
cd CellReport
dotnet build CellReport.sln
dotnet test Tests/Tests.csproj

Примеры

1. Загрузка шаблона, заполнение данных и экспорт в PDF

Пакет: KCellReport

using CellReport;
using CellReport.Export.Pdf;

// Загрузка шаблона (.tcr — XML, .tcrp — пакет)
var document = new ReportDocument(@"Templates\Invoice.tcrp");

// Секция «Строка» повторяется для каждой позиции
foreach (var item in items)
{
    document.AddSection("Строка");
    document.SetParameter("Наименование", item.Name);
    document.SetParameter("Количество", item.Qty);
    document.SetParameter("Цена", item.Price);
}

document.AddSection("Итого");
document.SetParameter("Сумма", total);

// Векторный PDF через Skia
using (var stream = File.Create(@"output\invoice.pdf"))
{
    PdfExporter.CreateVectorExporter(document.Manager).ExportTo(stream);
}

Экспорт в другие форматы:

using CellReport.Export.Excel;
using CellReport.Export.Html;
using CellReport.Export.Image;
using CellReport.Presenters.Skia;

var renderer = new SkiaReportRenderer();

using (var stream = File.Create(@"output\invoice.xlsx"))
    new ExcelExporter(document.Manager, renderer).ExportTo(stream);

using (var stream = File.Create(@"output\invoice.html"))
    new HtmlExporter(document.Manager, renderer).ExportTo(stream);

using (var stream = File.Create(@"output\invoice.png"))
    new ImageExporter(document.Manager, renderer).ExportTo(stream);

2. Просмотр отчёта в WinForms

Пакеты: KCellReport, KCellReport.WinForms

using CellReport;
using CellReport.Presenters.WinForms;
using System.Windows.Forms;

var document = new ReportDocument(@"Templates\Sales.tcrp");
document.AddSection("Данные");
document.SetParameter("Период", "Январь 2026");

// ReportForm содержит PresentControl с панелью инструментов
using (var form = new ReportForm())
{
    new DisplayPresenter(document.Manager, form);
    Application.Run(form);
}

Встраивание в существующую форму:


<PackageReference Include="KCellReport" Version="*" />
<PackageReference Include="KCellReport.WinForms" Version="*" />
var presentControl = new PresentControl();
var presenter = new DisplayPresenter(document.Manager, presentControl);
presentControl.Presenter = presenter;
Controls.Add(presentControl);

3. Avalonia: MVVM и встроенный просмотрщик

Пакеты: KCellReport, KCellReport.Avalonia

<PackageReference Include="KCellReport" Version="*" />
<PackageReference Include="KCellReport.Avalonia" Version="*" />
using CellReport;
using CellReport.Avalonia;
using CellReport.Avalonia.ViewModels;
using CellReport.Presenters;

var document = new ReportDocument(@"Templates\Stock.tcrp");
document.AddSection("Остатки");
document.SetParameter("Склад", "Основной");

var viewModel = new PresentControlViewModel(document.Manager);

<Window xmlns="https://github.com/avaloniaui"
        xmlns:cr="using:CellReport.Avalonia">
    <cr:PresentControl DataContext="{Binding ReportViewModel}" />
</Window>

PresentControlViewModel предоставляет команды экспорта (Excel, PDF, HTML, PNG), поиск, закладки, масштаб и печать (Windows).

4. WPF: встраивание в окно приложения

WPF-компонент пока не публикуется в NuGet и подключается из исходников вместе с проектами CellReport.WPF, CellReport.WinForms и CellReport.

<ProjectReference Include="..\CellReport\src\CellReport\CellReport.csproj" />
<ProjectReference Include="..\CellReport\src\CellReport.WinForms\CellReport.WinForms.csproj" />
<ProjectReference Include="..\CellReport\src\CellReport.WPF\CellReport.WPF.csproj" />
<Window xmlns:cr="clr-namespace:CellReport.Presenters.Wpf;assembly=CellReport.WPF">
    <cr:PresentControl x:Name="reportView" />
</Window>
using CellReport;
using CellReport.Presenters.Wpf;

var document = new ReportDocument(@"Templates\Order.tcr");
document.AddSection("Шапка");
document.SetParameter("Номер", orderNumber);

new DisplayPresenter(document.Manager, reportView);

5. Горизонтальное объединение секций

Пакет: KCellReport

var document = new ReportDocument(templateStream);

document.AddSection("Заголовок");
document.SetParameter("Месяц", "Июнь");

document.JoinSection("Заголовок");   // вторая колонка того же ряда
document.SetParameter("Месяц", "Июль");

document.AddSection("Строка");       // новая строка
document.SetParameter("Товар", "Кабель");

Форматы шаблонов

Расширение Описание
.tcr XML-шаблон
.tcrp ZIP-пакет (шаблон + стили + ресурсы)

Редактирование: проект CellReport.Editor в src/ или визуальный редактор из дистрибутива.

Безопасность шаблонов

Внешние file:// и http(s):// ресурсы по умолчанию отключены. Для доверенного шаблона их нужно разрешить явно до загрузки:

var template = new CellTemplate
{
    ExternalResourceOptions = new UriDataLoaderOptions
    {
        AllowFile = true,
        AllowedFileRoot = Path.GetFullPath("Templates"),
        MaxDataBytes = 10 * 1024 * 1024
    }
};
template.Load(@"Templates\Invoice.tcr");

Для HTTP дополнительно задаются AllowHttp = true и точный список AllowedHttpHosts. Размер XML, таблицы и ресурсов ограничивается через TemplateLoadOptions.

CellManager, ReportDocument и presenter-ы не предназначены для одновременного изменения из нескольких потоков. Отдельные документы можно формировать и экспортировать параллельно; один экземпляр документа следует использовать последовательно.

Сборка и тесты

# всё решение
dotnet build CellReport.sln

# только ядро
dotnet build src/CellReport/CellReport.csproj

# тесты
dotnet test Tests/Tests.csproj

Лицензия

MIT © Daniil Safonov

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. 
.NET Framework net48 is compatible.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on KCellReport:

Package Downloads
KCellReport.WinForms

CellReport для WinForms: просмотр, печать и GDI+-рендерер

KCellReport.Avalonia

CellReport для Avalonia 12: MVVM-компоненты просмотра и экспорта отчётов

Kayala

Kayala — framework for building trade automation systems. Includes template engine, localization, print forms, scheduling, data exchange and UI abstractions.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.14.1 55 10/30/2026
0.14.0 103 10/28/2026
0.13.1 165 8/23/2026
0.13.0 154 8/21/2026
0.12.1 169 6/15/2026
0.12.0 164 6/15/2026
0.11.2605.311 166 6/14/2026