Kck.Documents.Abstractions
5.0.0
dotnet add package Kck.Documents.Abstractions --version 5.0.0
NuGet\Install-Package Kck.Documents.Abstractions -Version 5.0.0
<PackageReference Include="Kck.Documents.Abstractions" Version="5.0.0" />
<PackageVersion Include="Kck.Documents.Abstractions" Version="5.0.0" />
<PackageReference Include="Kck.Documents.Abstractions" />
paket add Kck.Documents.Abstractions --version 5.0.0
#r "nuget: Kck.Documents.Abstractions, 5.0.0"
#:package Kck.Documents.Abstractions@5.0.0
#addin nuget:?package=Kck.Documents.Abstractions&version=5.0.0
#tool nuget:?package=Kck.Documents.Abstractions&version=5.0.0
Kck.Documents.Abstractions
Provider-agnostic document processing contracts for Excel generation, CSV export, and image resizing — implement with the ClosedXML or SkiaSharp providers.
Installation
dotnet add package Kck.Documents.Abstractions
Quick Start
using Kck.Documents.Abstractions;
// Program.cs — register concrete providers
builder.Services.AddKckDocumentsClosedXml(); // IExcelService + ICsvExporter
builder.Services.AddKckDocumentsSkiaSharp(); // IImageProcessor
public sealed record OrderRow(Guid Id, string Customer, decimal Total);
// Generate Excel / CSV files from a list
public class ReportHandler(IExcelService excel, ICsvExporter csv)
{
public async Task<byte[]> ExportOrdersExcelAsync(IReadOnlyList<OrderRow> rows, CancellationToken ct)
{
DocumentResult result = await excel.CreateFromDataAsync(rows, worksheetName: "Orders", ct: ct);
return result.Content; // also: result.ContentType, result.FileName
}
public async Task<byte[]> ExportOrdersCsvAsync(IReadOnlyList<OrderRow> rows, CancellationToken ct)
{
DocumentResult result = await csv.ExportAsync(rows, fileName: "orders.csv", ct: ct);
return result.Content;
}
}
// Resize an uploaded image
public class AvatarService(IImageProcessor processor)
{
public Task<byte[]> ThumbnailAsync(Stream imageStream, CancellationToken ct) =>
processor.ResizeAsync(imageStream, new ImageProcessingOptions { Width = 200, Height = 200, OutputFormat = "webp" }, ct);
}
Options
There is no configuration section; behaviour is set per call.
| Setting | Where | Default |
|---|---|---|
| Worksheet name | CreateFromDataAsync(..., worksheetName) |
"Sheet1" |
| CSV file name | ExportAsync(..., fileName) |
"export.csv" |
| Resize size / aspect ratio | ImageProcessingOptions.Width, Height, MaintainAspectRatio |
aspect ratio kept |
| Output format | ImageProcessingOptions.OutputFormat / ConvertFormatAsync(..., targetFormat) — SkiaSharp provider: jpeg (jpg), png, webp |
jpeg |
| Quality (JPEG / WebP) | ImageProcessingOptions.Quality |
80 |
Resources
| Product | Versions 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. |
-
net10.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Kck.Documents.Abstractions:
| Package | Downloads |
|---|---|
|
Kck.Documents.ClosedXml
ClosedXML-backed IExcelService and ICsvExporter implementations. Generates Excel workbooks from typed collections with auto-generated headers, and exports data to CSV format. Registered via AddKckDocumentsClosedXml(). |
|
|
Kck.Documents.ImageSharp
SixLabors.ImageSharp-backed IImageProcessor for server-side image operations. Supports resize (with aspect-ratio preservation), format conversion (JPEG, PNG, WebP, GIF, BMP), and image dimension reading. Registered via AddKckDocumentsImageSharp(). |
|
|
Kck.Documents.SkiaSharp
SkiaSharp-backed IImageProcessor for server-side image operations. Supports resize (with aspect-ratio preservation), format conversion (JPEG, PNG, WebP output; JPEG, PNG, WebP, GIF, BMP, ICO input), header-only dimension reading and a decoder-bomb pixel limit. Registered via AddKckDocumentsSkiaSharp(). On Linux add SkiaSharp.NativeAssets.Linux.NoDependencies to the application. |
GitHub repositories
This package is not used by any popular GitHub repositories.