Universal.OpenXml
5.0.0
dotnet add package Universal.OpenXml --version 5.0.0
NuGet\Install-Package Universal.OpenXml -Version 5.0.0
<PackageReference Include="Universal.OpenXml" Version="5.0.0" />
<PackageVersion Include="Universal.OpenXml" Version="5.0.0" />
<PackageReference Include="Universal.OpenXml" />
paket add Universal.OpenXml --version 5.0.0
#r "nuget: Universal.OpenXml, 5.0.0"
#:package Universal.OpenXml@5.0.0
#addin nuget:?package=Universal.OpenXml&version=5.0.0
#tool nuget:?package=Universal.OpenXml&version=5.0.0
Universal.OpenXml
Read, create and edit Word, Excel and PowerPoint files using the Open XML SDK. Targets .NET Standard 2.0.
Usage
using System.Collections.Generic;
using DocumentFormat.OpenXml.Packaging;
using Universal.OpenXml.Packaging;
using Universal.OpenXml.Wordprocessing;
MemoryStreamDocument<WordprocessingDocument>.EditFile("template.docx", "report.docx", document =>
{
document.FillContentControls(new Dictionary<string, ContentControlValue>
{
["customer"] = ContentControlValue.Text("Example customer")
});
});
The template must contain a compatible content control tagged customer. Missing tags and incompatible control types fail before normal mutation.
Capabilities
| Namespace | Operations |
|---|---|
Universal.OpenXml.Packaging |
Owned in-memory documents, isolated edit copies, staged file publication, parts and image relationships. |
Universal.OpenXml.Wordprocessing |
Formatting-preserving text edits, typed content controls, repeating items, authored tables, pictures and document sections. |
Universal.OpenXml.Spreadsheet |
Typed cells, ranges, explicit record mappings, named tables, number formats, styles, notes and dimensions. |
Universal.OpenXml.Presentation |
Slide composition and ordering, layout-based creation, shape/tag/placeholder discovery, text, tables, pictures and category-chart data. |
Table and slide positions are zero-based. Range and record operations materialize bounded datasets; their default limit is one million cells. Formula APIs store expressions and request recalculation; they do not evaluate formulas. Chart data replacement supports ordinary embedded-workbook 2D bar/column and line charts while retaining the authored series count.
Operations preserve supported authored formatting and reject structures requiring coordinated edits, such as protected formula groups, bound controls or unsupported chart dependencies. Member XML documentation describes each operation's limits and exceptions. Layout, pagination and rendering remain the responsibility of the consuming application or document renderer.
Ownership and editing
Open and EditCopy return disposable document owners. Borrowed input streams remain open and are read from their current position. EditCopy completes independent package serialization before returning; an optional callback validates the serialized result.
EditFile prepares an independent copy before publishing through a sibling staging file on a local rename-capable filesystem. Callers coordinate concurrent writers. External callback effects and filesystem publication failures are outside rollback guarantees. For workflows requiring original-package isolation, compose edits inside EditCopy or EditFile.
Cell and table snapshots remain usable after disposal. Discovery results containing SDK elements borrow their document's lifetime; structural edits can invalidate those handles.
Runtime and fonts
Package manipulation requires a .NET Standard 2.0-compatible host. It needs no Office installation, display server, System.Drawing.Common or libgdiplus.
Spreadsheet width measurement additionally requires readable files for the workbook's Normal font; an unspecified font defaults to Calibri 11pt. Supply a font catalog for deterministic deployment:
using Universal.Common.Fonts;
using Universal.OpenXml.Spreadsheet;
IFontResolver fonts = FontCatalog.CreateBuilder().AddDirectory(fontDirectory).Build();
int pixels = workbookPart.GetMaximumDigitWidth(fonts);
In Linux containers, copy the required fonts into a readable application directory and pass that directory to the catalog. Named-culture formatting requires an ICU/globalization-enabled runtime. The separate renderer used to display, print or export documents needs the template's fonts; substitutions can change wrapping and appearance.
| Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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. |
-
.NETStandard 2.0
- DocumentFormat.OpenXml (>= 3.5.1)
- Universal.Common (>= 8.5.0)
- Universal.Common.Fonts (>= 1.3.1)
- Universal.Common.Security (>= 1.3.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Universal.OpenXml:
| Package | Downloads |
|---|---|
|
Universal.Common.Data
Class library for working with common data formats and files and mapping them to and from C# objects. |
|
|
Universal.Common.Forms.Rendering
A class library for rendering Universal.Common.Forms.Form. |
|
|
Universal.OpenXml.Markdown
Class library for rendering Markdown in OpenXML. |
|
|
Universal.Frameworks.Documents
Class library that provides dynamic rendering of OpenXML word processing documents in a data-driven way. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 5.0.0 | 158 | 11/13/2026 |
| 4.0.1 | 2,301 | 12/3/2024 |
| 4.0.0 | 224 | 12/3/2024 |
| 3.6.5 | 1,678 | 10/31/2024 |
| 3.6.4.2 | 422 | 1/25/2024 |
| 3.6.4.1 | 325 | 12/15/2023 |
| 3.6.4 | 319 | 11/20/2023 |
| 3.6.3 | 284 | 11/9/2023 |
| 3.6.2 | 249 | 11/9/2023 |
| 3.6.1 | 281 | 11/8/2023 |
| 3.6.0.1 | 678 | 10/23/2023 |
| 3.6.0 | 298 | 10/3/2023 |
| 3.5.7 | 287 | 9/26/2023 |
| 3.5.6.2 | 285 | 9/26/2023 |
| 3.5.6.1 | 289 | 9/26/2023 |
| 3.5.6 | 262 | 9/26/2023 |
| 3.5.5.2 | 272 | 9/22/2023 |
| 3.5.5.1 | 290 | 9/22/2023 |
| 3.5.5 | 309 | 9/18/2023 |
| 3.5.4 | 4,889 | 10/26/2022 |
Adds isolated EditCopy/EditFile workflows, literal text batches, typed Word control/repeating-item population, spreadsheet ranges/records/named tables, authored Word/DrawingML tables, copy-on-write raster replacement, slide discovery/insertion/reordering/layout creation and coordinated embedded-workbook category charts. Retains .NET Standard 2.0, minimal Microsoft/Universal dependencies. See package documentation for explicit supported boundaries and behavior refinements.