IronWord with DocumentFormat.OpenXml
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
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.

