IronWord with DocumentFormat.OpenXml

Please noteThis conflict was fixed in IronWord 2025.7.13 — over a year before the current release. If your project is already on a recent IronWord version, you are unlikely to encounter this issue; the guidance below remains for teams still on an older build or who see similar symptoms after upgrading.

IronWord versions prior to 2025.7.13 could produce corrupted documents, incorrect formatting, or runtime errors when run alongside DocumentFormat.OpenXml in the same project. This dependency-version conflict was fixed in IronWord 2025.7.13. The guidance below applies if your project is on an older build, or if you still encounter conflicts after upgrading.

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, which has been tested 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

WarningOn IronWord builds prior to 2025.7.13, using a newer version of DocumentFormat.OpenXml may reproduce this conflict.

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 49,216 | 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.