DocWright.Core
1.7.0
dotnet add package DocWright.Core --version 1.7.0
NuGet\Install-Package DocWright.Core -Version 1.7.0
<PackageReference Include="DocWright.Core" Version="1.7.0" />
<PackageVersion Include="DocWright.Core" Version="1.7.0" />
<PackageReference Include="DocWright.Core" />
paket add DocWright.Core --version 1.7.0
#r "nuget: DocWright.Core, 1.7.0"
#:package DocWright.Core@1.7.0
#addin nuget:?package=DocWright.Core&version=1.7.0
#tool nuget:?package=DocWright.Core&version=1.7.0
DocWright.Core
Foundation package for DocWright: measurement primitives, extension points, structured diagnostics, resource limits and the exception taxonomy.
Zero dependencies.
Install
dotnet add package DocWright.Core
You almost certainly want DocWright
instead — it includes this package. Install DocWright.Core directly only when you are
writing something that plugs into DocWright and does not need the rest of it.
What is in it
Measurement primitives — Twips, Emu, ColorRgb. Word's model is twip-based
(1 point = 20 twips, 1 inch = 1440 twips), and DocWright mirrors it with integer arithmetic
so results are identical across platforms and framework versions.
using DocWright.Core.Primitives;
Twips margin = Twips.FromInches(1); // 1440
Twips size = Twips.FromPoints(11); // 220
Extension points — IDocumentReader, IDocumentWriter, ILayoutRenderer,
ITextShaper. Implement a reader or writer to add a format and register it through the
DocumentFormatRegistry you pass to the converter; set a shaper on
ConvertOptions.TextShaper; implement a renderer to draw laid-out pages yourself.
Diagnostics — IConversionDiagnostics and ConversionDiagnostic report what a
conversion had to approximate, substitute or preserve opaquely, each with a stable
diagnostic code.
var diagnostics = new CollectingConversionDiagnostics();
converter.Convert(input, output, new ConvertOptions { Diagnostics = diagnostics });
foreach (var d in diagnostics.Snapshot())
{
Console.WriteLine($"{d.Code} {d.Severity}: {d.Message}");
}
Resource limits — ResourceLimits bounds input size, decompressed size, package entry
count, compression ratio, image pixels, nesting depth and wall-clock time. The limits whose
worst case is not proportional to input size are on by default.
Exception taxonomy — every failure a caller can act on derives from DocWrightException,
so one catch covers the library.
Requirements
.NET Framework 4.8, .NET Standard 2.0, .NET 8.0 or .NET 10.0.
Documentation
📖 DocWright documentation ·
How DocWright works ·
Diagnostic codes ·
Handle errors ·
API reference: DocWright.Core
Contact
Questions, support or licensing: salwan@albahadly.com · www.albahadly.com
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
- 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
- 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
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (25)
Showing the top 5 NuGet packages that depend on DocWright.Core:
| Package | Downloads |
|---|---|
|
DocWright.Dom
The mutable document model and editing API for DocWright: sections, paragraphs, tables, styles, numbering, theme and settings, tracked changes, content controls and form fields, plus find/replace and {{placeholder}} filling. Markup it does not model is preserved rather than dropped, so a load-and-save round-trip is lossless. Most users should install the DocWright package instead, which includes this one. |
|
|
DocWright.Fonts
Font discovery, OpenType TTF/OTF/TTC parsing, metric-compatible substitution and Word-compatible text measurement for DocWright. Bundles OFL-licensed fallback faces so output stays reasonable on a machine with no fonts installed, and reports every substitution it makes. Zero dependencies. Most users should install the DocWright package instead, which includes this one. |
|
|
DocWright.Ole
Compound File Binary (MS-CFB) reader and OLE payload extraction for DocWright — the container format that legacy .doc files, encrypted Office packages and embedded objects all sit inside. Treats its input as untrusted: traversal is bounded and declared sizes are checked before anything is allocated. Zero third-party dependencies. |
|
|
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.Renderers.Imaging
The raster renderer for DocWright: renders document or PDF pages to PNG or JPEG. No System.Drawing, no SkiaSharp and no native binaries — the rasterizer and both encoders are included. Integer arithmetic throughout, so the same page renders byte-identically across platforms and framework versions. Most users should install the DocWright package instead, which includes this one. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Guides, tutorials and API reference: https://docs.albahadly.com/docwright/