Berry.Docx 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Berry.Docx --version 1.0.1
NuGet\Install-Package Berry.Docx -Version 1.0.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="Berry.Docx" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Berry.Docx --version 1.0.1
#r "nuget: Berry.Docx, 1.0.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.
// Install Berry.Docx as a Cake Addin
#addin nuget:?package=Berry.Docx&version=1.0.1

// Install Berry.Docx as a Cake Tool
#tool nuget:?package=Berry.Docx&version=1.0.1

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/>

Install via NuGet

If you want to include Berry.Docx in your project, you can install it directly from NuGet.

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.FontEN = "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].Range.ChildObjects.Add(p1);
            doc.Sections[0].Range.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

<br/>

Documentation

<br/>

Release History

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.
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last updated
1.3.7 277 6/16/2023
1.3.6 147 5/29/2023
1.3.5 172 5/12/2023
1.3.4 179 4/13/2023
1.3.3 211 3/22/2023
1.3.2 417 8/26/2022
1.3.1 405 8/2/2022
1.3.0 379 8/1/2022
1.2.0 422 3/22/2022
1.1.0 431 3/6/2022
1.0.1 432 2/11/2022
1.0.0 433 2/11/2022

- Supports add/remove paragraphs;
- Supports add/remove tables, and add/insert rows, columns, cells, paragraphs to the table.