/docx4j.NET

docx4j is an open source (ASLv2) library for docx/pptx/xlsx, similar in concept to Open XML SDK, but with its own particular strengths including content control databinding (with OpenDoPE enhancements), XHTML import/export, PDF output, and MERGEFIELD processing. This is the .NET version of docx4j.

Primary LanguageC#Apache License 2.0Apache-2.0

docx4j.NET

.NET bindings for docx4j

Motivation

Microsoft's Open XML SDK is the de facto way of working with docx/pptx/xlsx files in .NET environment.

However, it is quite a low level API; there is useful additional functionality in docx4j (see samples below), which can be utilised in a .NET environment.

Also, some docx4j users server side want to standardise on a single API, and so use docx4j client side (eg via VSTO AddIn).

Users

You can install the NuGet package; see http://www.nuget.org/packages/docx4j.NET/

Samples

Installing the NuGet package will add a dir src to your project; in src/samples you will see sample code for:

  • simple HelloWorld docx
  • docx desensitization/anonymization (so a docx can be sent for tech support without disclosing anything sensitive)
  • ToC updating
  • docx to PDF (in v3.3.x, this uses Plutext's PDF Converter, not docx4j per se)
  • docx to HTML
  • mail merge (MERGEFIELD processing)
  • content control data binding All of those should run out of the box (provided you have set: Project Properties > Startup object)

For examples of how to do other stuff with docx4j, please see https://github.com/plutext/docx4j/tree/master/src/samples Translating any of that code from Java to C# ought to be straightforward.

Developers

You can clone this project.

The easiest way to add the needed references is still via NuGet.