Bsa.Pdf.Office 1.0.20

There is a newer version of this package available.
See the version list below for details.
dotnet add package Bsa.Pdf.Office --version 1.0.20
                    
NuGet\Install-Package Bsa.Pdf.Office -Version 1.0.20
                    
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="Bsa.Pdf.Office" Version="1.0.20" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bsa.Pdf.Office" Version="1.0.20" />
                    
Directory.Packages.props
<PackageReference Include="Bsa.Pdf.Office" />
                    
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 Bsa.Pdf.Office --version 1.0.20
                    
#r "nuget: Bsa.Pdf.Office, 1.0.20"
                    
#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 Bsa.Pdf.Office@1.0.20
                    
#: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=Bsa.Pdf.Office&version=1.0.20
                    
Install as a Cake Addin
#tool nuget:?package=Bsa.Pdf.Office&version=1.0.20
                    
Install as a Cake Tool

Bsa.Pdf.Office

Запись документов Word (.docx) и книг Excel (.xlsx) на чистом C#: без Open XML SDK, NPOI, EPPlus и других библиотек. .NET 6, .NET 8, .NET 10 — Windows, Linux, macOS. Файлы открывают Microsoft Office, LibreOffice, «Р7-Офис», МойОфис.

Установка

dotnet add package Bsa.Pdf.Office

Word

using Bsa.Pdf.Office.Word;

var document = new DocxDocument { Title = "Отчёт", FontName = "Times New Roman", FontSize = 12 };
document.AddParagraph(new DocxParagraph
{
    Alignment = DocxAlignment.Center,
    Runs = { new DocxRun { Text = "Отчёт за квартал", Bold = true, FontSize = 16 } },
});
document.AddParagraph(DocxParagraph.Of("Обычный абзац.\nВторая строка того же абзаца."));
document.AddTable(new[]
{
    new[] { "Показатель", "Значение" },
    new[] { "Выручка", "1 250 000" },
});
document.AddPageBreak();
document.AddParagraph(new DocxParagraph { IndentLeft = 36, Runs = { new DocxRun { Text = "С отступом", Italic = true, Color = "C00000" } } });

File.WriteAllBytes("report.docx", document.Save());
Тип Что задаёт
DocxDocument Page (размер листа и поля в пунктах, по умолчанию A4, поля 2 см), FontName, FontSize, Title; AddParagraph, AddTable, AddImage (PNG или JPEG отдельным абзацем; шире текста листа — уменьшается), AddPageBreak, Save
DocxParagraph Runs, Alignment (Left, Center, Right, Justify), IndentLeft, SpaceAfter (пункты)
DocxRun Text (перевод строки — разрыв строки), Bold, Italic, FontSize, Color (RRGGBB), FontName

Excel

using Bsa.Pdf.Office.Excel;

var book = new XlsxWorkbook { Title = "Реестр" };
var sheet = book.AddSheet("Платежи");
sheet.SetText(0, 0, "Дата");
sheet.SetText(0, 1, "Сумма");
sheet.SetText(1, 0, "18.11.2026");
sheet.SetNumber(1, 1, 1250.5);
sheet.SetColumnWidth(0, 14);

File.WriteAllBytes("registry.xlsx", book.Save());

Строки и столбцы — с нуля (XlsxSheet.CellName(0, 0) — A1). Имя листа очищается от недопустимых символов и укорачивается до 31 символа, повтор дополняется номером.

Ограничения

  • Изображения в Word — только в строке (без обтекания); без стилей заголовков, колонтитулов и списков; без формул, форматов чисел и оформления ячеек в Excel.
  • Чтение — только документов Word для вёрстки (Bsa.Pdf.Office.Word.Reading.DocxReader: разделы, колонтитулы, абзацы с оформлением из стилей и темы, списки, таблицы, изображения) и книг Excel (Bsa.Pdf.Office.Excel.Reading.XlsxReader: видимые листы, показываемый текст ячеек по форматам чисел и дат — XlsxNumberFormat, стили ячеек, размеры строк и столбцов, объединения, параметры и область печати; без формул и изображений).
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.
  • net10.0

    • No dependencies.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bsa.Pdf.Office:

Package Downloads
Bsa.Pdf.Convert

Convert Word (.docx), Excel (.xlsx) and PDF documents to page images (PNG, JPEG, multi-page TIFF) and Word/Excel to PDF in C#: own layout engine for paragraphs, tables, headers and footers, footnotes, EMF/WMF pictures and Excel charts; pages are rendered with PDFium. No Microsoft Office, LibreOffice or Open XML SDK; Windows, Linux, macOS.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.42 58 11/20/2026
1.0.20 58 11/19/2026