DocWright.Dom
1.1.1
dotnet add package DocWright.Dom --version 1.1.1
NuGet\Install-Package DocWright.Dom -Version 1.1.1
<PackageReference Include="DocWright.Dom" Version="1.1.1" />
<PackageVersion Include="DocWright.Dom" Version="1.1.1" />
<PackageReference Include="DocWright.Dom" />
paket add DocWright.Dom --version 1.1.1
#r "nuget: DocWright.Dom, 1.1.1"
#:package DocWright.Dom@1.1.1
#addin nuget:?package=DocWright.Dom&version=1.1.1
#tool nuget:?package=DocWright.Dom&version=1.1.1
DocWright.Dom
The mutable document model for DocWright, plus the editing API: sections, paragraphs, runs, tables, styles, numbering, theme, tracked changes, content controls, form fields and lossless round-trip preservation.
Install
dotnet add package DocWright.Dom
Most people should install DocWright
instead — it includes this package and gives you the Load and Save calls that put a
document in your hands.
Editing a document
using DocWright;
using DocWright.Dom;
using DocWright.Dom.Editing;
var converter = new DocWrightConverter();
using WordDocument document = converter.Load(File.OpenRead("template.docx"));
// Find and replace, across runs and formatting boundaries
document.Replace("Contoso", "Fabrikam");
// {{placeholder}} template filling
document.ReplacePlaceholders(new Dictionary<string, object?>
{
["CustomerName"] = "Fabrikam Inc.",
["Total"] = 1499.00m,
});
using FileStream output = File.Create("filled.docx");
converter.Save(document, output);
What the editing API covers
- Find and replace, including matches split across runs
{{placeholder}}filling with a key-value map, scoped to any node — a single table row, a header, or the whole document- Bookmarks and ranges
- Merge and split documents
- Content controls and legacy form fields
- Fields and field results
- Tracked changes: accept, reject, enumerate
- Custom-XML data binding
Sparse by design
Formatting is stored sparsely — the model records whether a value was set explicitly or inherited. That is what lets a save write back only what the source actually had, instead of flattening every inherited property into an explicit one.
Lossless preservation
Markup the model does not represent is preserved opaquely rather than dropped, and wins on write. Load-and-save keeps features this library has no opinion about.
Requirements
.NET Framework 4.8, .NET Standard 2.0, .NET 8.0 or .NET 10.0.
License
MIT.
| 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 is compatible. 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 is compatible. 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 is compatible. 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. |
-
.NETFramework 4.8
- DocWright.Core (>= 1.1.1)
- Microsoft.Bcl.HashCode (>= 1.1.1)
- System.Buffers (>= 4.6.1)
- System.Memory (>= 4.6.3)
- System.Runtime.CompilerServices.Unsafe (>= 6.1.2)
-
.NETStandard 2.0
- DocWright.Core (>= 1.1.1)
- Microsoft.Bcl.HashCode (>= 1.1.1)
- System.Buffers (>= 4.6.1)
- System.Memory (>= 4.6.3)
- System.Runtime.CompilerServices.Unsafe (>= 6.1.2)
-
net10.0
- DocWright.Core (>= 1.1.1)
-
net8.0
- DocWright.Core (>= 1.1.1)
NuGet packages (14)
Showing the top 5 NuGet packages that depend on DocWright.Dom:
| Package | Downloads |
|---|---|
|
DocWright.Formats.Html
HTML import and export for DocWright: a tolerant, dependency-free HTML5 parser that recovers from malformed markup the way a browser does, a documented CSS subset, and an HTML writer with self-contained (images inlined as data URIs) and linked output modes. Most users should install the DocWright package instead, which includes this one. |
|
|
DocWright.Cryptography
Password-protected Office documents for DocWright: ECMA-376 agile and standard encryption (read and write), legacy Word 97 RC4 and RC4 CryptoAPI (read), and document-protection password hashes. Uses only the .NET base class library — no third-party cryptography. Digital signatures are a separate package, DocWright.Signatures. |
|
|
DocWright.Formats.Docx
DOCX reader and writer for DocWright: single-pass WordprocessingML parsing into the mutable document model, and a writer that round-trips losslessly by preserving markup it does not model rather than dropping it. The only DocWright package that depends on DocumentFormat.OpenXml. Most users should install the DocWright package instead, which includes this one. |
|
|
DocWright.Formats.Odt
OpenDocument Text (.odt) export for DocWright: a dependency-free ODF 1.3 writer producing a complete, deterministic OpenDocument package that LibreOffice and OpenOffice open directly. Export only — there is no ODT reader. Most users should install the DocWright package instead, which includes this one. |
|
|
DocWright.Formats.Doc
Legacy Word 97-2003 (.doc) reader for DocWright, including files encrypted with Office 97 RC4 or RC4 CryptoAPI. Read only — there is no .doc writer; open a legacy file and save it as .docx to modernise it. Most users should install the DocWright package instead, which includes this one. |
GitHub repositories
This package is not used by any popular GitHub repositories.
See https://github.com/albahadly/DocWright/releases for release notes.