Berry.Docx
1.2.0
See the version list below for details.
dotnet add package Berry.Docx --version 1.2.0
NuGet\Install-Package Berry.Docx -Version 1.2.0
<PackageReference Include="Berry.Docx" Version="1.2.0" />
paket add Berry.Docx --version 1.2.0
#r "nuget: Berry.Docx, 1.2.0"
// Install Berry.Docx as a Cake Addin #addin nuget:?package=Berry.Docx&version=1.2.0 // Install Berry.Docx as a Cake Tool #tool nuget:?package=Berry.Docx&version=1.2.0
English | 简体中文
<br/>
Berry.Docx
Berry.Docx is a .NET library for reading, manipulating and writing Word 2007+ (.docx) files without the Word application. It aims to provide an intuitive, full and user-friendly interface to dealing with the underlying OpenXML API.
<br/>
Packages
The release NuGet packages for Berry.Docx are on NuGet.org:
Package | Download |
---|---|
Berry.Docx |
Install via NuGet
If you want to include Berry.Docx in your project, you can install it directly from NuGet.
Open your project in Visual Studio, right-click the solution and select Manager NuGet Packages , then enter "Berry.Docx" in the Browse input box, as follows:
Select and install.
Or you could run the following command in the Package Manager Console to install it.
PM> Install-Package Berry.Docx
<br/>
Examples
The following example shows how to create a new document file, and add a new paragraph with "Times New Roman font, 14 point, Center justification" format,and a 3x3 size table.
using Berry.Docx;
using Berry.Docx.Documents;
namespace Example
{
class Example
{
static void Main()
{
// Create a new word document called “example.docx”
Document doc = new Document("example.docx");
// Create a new paragraph
Paragraph p1 = doc.CreateParagraph();
p1.Text = "This is a paragraph.";
p1.CharacterFormat.FontNameAscii = "Times New Roman";
p1.CharacterFormat.FontSize = 14;
p1.Format.Justification = JustificationType.Center;
// Create a new table
Table tbl1 = doc.CreateTable(3, 3);
tbl1.Rows[0].Cells[1].Paragraphs[0].Text = "1st Column";
tbl1.Rows[0].Cells[2].Paragraphs[0].Text = "2nd Column";
tbl1.Rows[1].Cells[0].Paragraphs[0].Text = "1st Row";
tbl1.Rows[2].Cells[0].Paragraphs[0].Text = "2nd Row";
// Add to the document
doc.Sections[0].ChildObjects.Add(p1);
doc.Sections[0].ChildObjects.Add(tbl1);
// Save and close
doc.Save();
doc.Close();
}
}
}
<br/>
Main Features
Features |
---|
Open existing DOCX files Or Create new DOCX files |
Get sections |
Get paragraphs of section Or Append/Insert new paragraphs |
Get characters of paragraph Or Append/Insert new characters |
Get/Set character format(FontCN, FontEN, FontSize, Bold, Italic) |
Get/Set paragraph format(Justification, OutlineLevel, Indentation, Spacing etc.) |
Get paragraph style |
Get tables of section Or Append/Insert new tables |
Get table rows and cells |
Insert Rows/Columns around table cells |
Get/Set table cell paragraphs |
Inserts section break |
Appends comments |
Manipulates header and footers |
<br/>
Documentation
<br/>
Release History
v1.2.0 (2022-03-22)
Added
- Supports manipulating headers and footers.
v1.1.0 (2022-03-06)
Added
- Supports more character and paragraph advanced formats;
- Supports insert section break;
- Supports append paragraph comments.
v1.0.1 (2022-02-11)
Added
Supports add/remove paragraphs;
Supports add/remove tables, and add/insert rows, columns, cells, paragraphs to the table.
v1.0.0(2022-01-03)
Added
- Supports create & open DOCX files;
- Supports read and change the normal format(Font、Justification、Indentation、Spacing) of paragraph.
<br/>
RoadMap
Below are the future plans for the project.
April 2022 - 1.3.0
- Support get/set page setup
- Support add/remove styles
- Support add/remove paragraph list styles
- Support get/set table formats
May 2022 - 1.4.0
- Support add/remove pictures and get/set picture formats
- Support add/remove shapes and get/set shape formats
June 2022 - 1.5.0
- Support insert field codes
- Support insert footnote and endnote
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- DocumentFormat.OpenXml (>= 2.15.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Berry.Docx:
Package | Downloads |
---|---|
Berry.Docx.Visual
一款用于构建 DOCX 文档在显示时的组成结构的 .NET 库。通过此项目,我们可以访问文档中的页面、表格、段落以及其中的字符和图片等,以及这些内容的尺寸和边距等格式。 A.NET library for building the structure of a DOCX document when it is displayed. Through this project, we can access the pages, tables, paragraphs, characters and images in the document, as well as the format of the dimensions and margins of these contents. |
GitHub repositories
This package is not used by any popular GitHub repositories.
- Supports manipulating headers and footers.