IronWord with DocumentFormat.OpenXml

Running IronWord alongside DocumentFormat.OpenXml can produce corrupted documents, incorrect formatting, or runtime errors when the two packages share a project.

System.InvalidOperationException
NullReferenceException

The trouble comes from internal type and dependency mismatches between IronWord and newer releases of DocumentFormat.OpenXml. When those versions disagree, you see document corruption, broken formatting, or exceptions thrown at runtime.

Solution

Option 1: Pin DocumentFormat.OpenXml to 2.8.1

If your project genuinely needs both packages, lock DocumentFormat.OpenXml to version 2.8.1. It is the only version known to coexist with IronWord without stability or output problems.

Install-Package DocumentFormat.OpenXml -Version 2.8.1
Install-Package DocumentFormat.OpenXml -Version 2.8.1
SHELL

WarningAny newer version of DocumentFormat.OpenXml is unsupported and may break IronWord.

Option 2: Drop DocumentFormat.OpenXml

When the package is not essential to your workflow, remove it and rely on IronWord alone. Using IronWord on its own avoids the conflict entirely and keeps output reliable.

Curtis Chau
Technical Writer

Curtis Chau holds a Bachelor’s degree in Computer Science (Carleton University) and specializes in front-end development with expertise in Node.js, TypeScript, JavaScript, and React. Passionate about crafting intuitive and aesthetically pleasing user interfaces, Curtis enjoys working with modern frameworks and creating well-structured, visually appealing manuals.

...

Read More
Ready to Get Started?
Nuget Downloads 47,210 | Version: 2026.7 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast? PM > Install-Package IronWord
run a sample watch your data become a Word doc.