PrintKit 8.6.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package PrintKit --version 8.6.0
NuGet\Install-Package PrintKit -Version 8.6.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="PrintKit" Version="8.6.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PrintKit" Version="8.6.0" />
<PackageReference Include="PrintKit" />
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 PrintKit --version 8.6.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PrintKit, 8.6.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 PrintKit@8.6.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=PrintKit&version=8.6.0
#tool nuget:?package=PrintKit&version=8.6.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
PrintKit
Библиотека для печати таблиц (DataTable, DataGridView) в WinForms-приложениях с предварительным просмотром (.NET 8).
Установка
dotnet add package PrintKit
Быстрый старт
using PrintKit;
// Предварительный просмотр DataTable
PrintHelper.Preview(dataTable, "Отчёт по вакансиям");
// Предварительный просмотр DataGridView
PrintHelper.Preview(dataGridView1, "Отчёт по сотрудникам");
// Печать напрямую (без предварительного просмотра)
PrintHelper.Print(dataTable, "Отчёт");
Возможности
- Заголовок по центру (жирный, 16pt)
- Шапка таблицы с серым фоном
- Чередование цветов строк для удобства чтения
- Автоматический расчёт ширины столбцов
- Поддержка многостраничной печати
- Автоматическая альбомная ориентация для широких таблиц (более 5 столбцов)
- Дата печати в нижнем колонтитуле
Пример: печать списка вакансий
public partial class MainForm : Form
{
private void btnPrint_Click(object sender, EventArgs e)
{
// Печать из DataGridView — передаём то, что видит пользователь
PrintHelper.Preview(dataGridView1, "Список вакансий");
}
private void btnPrintAll_Click(object sender, EventArgs e)
{
// Печать из DataTable — все данные, включая отфильтрованные
using var db = new AppDbContext();
var dt = new DataTable();
var vacancies = db.Vacancies
.Include(v => v.Department)
.ToList();
dt.Columns.Add("Должность");
dt.Columns.Add("Отдел");
dt.Columns.Add("Зарплата");
dt.Columns.Add("Дата публикации");
foreach (var v in vacancies)
{
dt.Rows.Add(v.Title, v.Department.Name,
v.Salary.ToString("N0") + " руб.",
v.PublishedDate.ToString("dd.MM.yyyy"));
}
PrintHelper.Preview(dt, "Полный список вакансий");
}
private void btnQuickPrint_Click(object sender, EventArgs e)
{
// Быстрая печать без предварительного просмотра
PrintHelper.Print(dataGridView1, "Вакансии");
}
}
Описание методов
| Метод | Описание |
|---|---|
PrintHelper.Preview(dataTable, title) |
Предварительный просмотр и печать DataTable |
PrintHelper.Preview(dataGridView, title) |
Предварительный просмотр и печать DataGridView |
PrintHelper.Print(dataTable, title) |
Печать DataTable напрямую на принтер |
Требования
- .NET 8.0
- Windows Forms
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows 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.
-
net8.0-windows7.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on PrintKit:
| Package | Downloads |
|---|---|
|
ISBuilder
Information System Builder — full toolkit for building .NET 8 WinForms applications with EF Core, SQL Server. Export, CRUD, forms, charts, auth, reports, validation, themes. |
GitHub repositories
This package is not used by any popular GitHub repositories.