OfficeIMO.Drawing 1.0.13

Prefix Reserved
dotnet add package OfficeIMO.Drawing --version 1.0.13
                    
NuGet\Install-Package OfficeIMO.Drawing -Version 1.0.13
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OfficeIMO.Drawing" Version="1.0.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OfficeIMO.Drawing" Version="1.0.13" />
                    
Directory.Packages.props
<PackageReference Include="OfficeIMO.Drawing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OfficeIMO.Drawing --version 1.0.13
                    
#r "nuget: OfficeIMO.Drawing, 1.0.13"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OfficeIMO.Drawing@1.0.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OfficeIMO.Drawing&version=1.0.13
                    
Install as a Cake Addin
#tool nuget:?package=OfficeIMO.Drawing&version=1.0.13
                    
Install as a Cake Tool

OfficeIMO.Drawing

OfficeIMO.Drawing is the shared first-party drawing layer for OfficeIMO packages. It provides small color and image metadata primitives without taking a dependency on a raster imaging library.

What It Provides

  • OfficeColor: immutable RGBA color value with named colors and hex parsing.
  • OfficeFontInfo: immutable font family, size, and style descriptor for Office text features.
  • OfficeFontStyle: dependency-free font style flags.
  • OfficeTextMeasurer: deterministic text measurement estimates for Office layout decisions.
  • OfficeTextMeasurementStyle and OfficeTextMetrics: normalized measurement inputs and pixel metrics.
  • OfficeImageReader: header-only image metadata reader for common Office image formats.
  • OfficeImageInfo: image format, dimensions, DPI, and MIME metadata.
  • OfficeImageFormat: supported format enum used by OfficeIMO packages.
  • OfficeImageFit: reusable image fitting intent for stretch, contain, and cover placement.
  • OfficeGradientStop and OfficeLinearGradient: reusable two-stop linear gradient fill descriptors in normalized local coordinates.
  • OfficeShadow: reusable shape shadow intent with color, opacity, and offset.
  • OfficePoint, OfficeTransform, OfficePathCommand, OfficeShape, OfficeShapeKind, OfficeStrokeDashStyle, OfficeStrokeLineCap, and OfficeStrokeLineJoin: dependency-free vector shape descriptors that format-specific packages can map into their own coordinate systems.
  • OfficeDrawing and OfficeDrawingShape: reusable drawing scenes made from positioned shared shapes.

Supported Image Metadata

OfficeImageReader identifies PNG, JPEG, GIF, BMP, TIFF, ICO, PCX, EMF, placeable WMF, and SVG dimensions from headers or markup. It also maps Office-compatible extension-only formats so callers can still choose the right Open XML part type when dimensions are not available.

The reader is intentionally metadata-only. It does not decode pixels, resize, transcode, or validate complete image payloads.

OfficeImageFit gives format-specific renderers a shared way to describe image placement inside a target box:

using OfficeIMO.Drawing;

var mode = OfficeImageFit.Contain;

Stretch fills the box exactly, Contain preserves aspect ratio while fitting the whole image, and Cover preserves aspect ratio while filling the box and clipping overflow.

Color Migration

OfficeIMO packages now use OfficeIMO.Drawing.OfficeColor instead of external imaging color types.

using OfficeIMO.Drawing;

var color = OfficeColor.Parse("#336699");
var accent = OfficeColor.CornflowerBlue;

OfficeColor accepts named colors, #RGB, #RGBA, #RRGGBB, and #RRGGBBAA values.

Font Descriptors

OfficeFontInfo records the font family, point size, and style flags without taking a dependency on a font engine.

using OfficeIMO.Drawing;

var font = new OfficeFontInfo("Calibri", 11, OfficeFontStyle.Bold | OfficeFontStyle.Italic | OfficeFontStyle.Underline);

Text Measurement

OfficeTextMeasurer provides deterministic Office-oriented estimates for width and line height. It intentionally does not call operating-system font APIs, so results stay stable across machines.

using OfficeIMO.Drawing;

var measurer = OfficeTextMeasurer.Create(OfficeFontInfo.Default);
var style = measurer.CreateStyle(new OfficeFontInfo("Aptos", 12, OfficeFontStyle.Bold));
OfficeTextMetrics metrics = measurer.Measure("OfficeIMO", style);

Rendering packages can use these estimates for layout planning while keeping public and shared APIs free of font-engine dependencies. Format-specific packages still own their own unit conversions and layout quirks, such as Excel column width units or PDF page coordinates.

Vector Shape Descriptors

OfficeShape stores simple reusable vector shape intent without choosing a final file format or coordinate system.

using OfficeIMO.Drawing;

var badge = OfficeShape.Rectangle(160, 48);
badge.FillColor = OfficeColor.WhiteSmoke;
badge.FillGradient = OfficeLinearGradient.Horizontal(OfficeColor.SteelBlue, OfficeColor.WhiteSmoke);
badge.Shadow = new OfficeShadow(OfficeColor.Black, 0.18, 3, 4);
badge.StrokeColor = OfficeColor.SteelBlue;
badge.StrokeWidth = 1.5;
badge.StrokeDashStyle = OfficeStrokeDashStyle.Dash;
badge.FillOpacity = 0.85;
badge.StrokeOpacity = 0.95;
badge.Transform = OfficeTransform.Translate(4, 8);
badge.ClipPath = OfficeClipPath.Rectangle(120, 36);

var pill = OfficeShape.RoundedRectangle(120, 32, 8);
pill.FillColor = OfficeColor.WhiteSmoke;
pill.StrokeColor = OfficeColor.SteelBlue;

var marker = OfficeShape.Ellipse(48, 24);
marker.FillColor = OfficeColor.SteelBlue;

var connector = OfficeShape.Line(0, 0, 120, 24);
connector.StrokeColor = OfficeColor.SteelBlue;
connector.StrokeWidth = 2;
connector.StrokeDashStyle = OfficeStrokeDashStyle.Dash;
connector.StrokeLineCap = OfficeStrokeLineCap.Round;

var triangle = OfficeShape.Polygon(
    new OfficePoint(0, 40),
    new OfficePoint(40, 0),
    new OfficePoint(80, 40));
triangle.FillColor = OfficeColor.WhiteSmoke;

var curve = OfficeShape.Path(
    OfficePathCommand.MoveTo(0, 40),
    OfficePathCommand.CubicBezierTo(20, 0, 60, 0, 80, 40),
    OfficePathCommand.Close());
curve.StrokeColor = OfficeColor.SteelBlue;
curve.StrokeLineJoin = OfficeStrokeLineJoin.Round;

OfficeLinearGradient stores two-stop linear fill intent in normalized local coordinates. PDF can map it to axial shading resources, while Open XML renderers can map the same descriptor to native drawing gradients.

badge.FillGradient = OfficeLinearGradient.DiagonalDown(OfficeColor.SteelBlue, OfficeColor.WhiteSmoke);

OfficeShadow stores simple reusable shape-effect intent. Renderers can map it to native shadows, PDF alpha-backed offset geometry, or another format-specific effect model.

badge.Shadow = new OfficeShadow(OfficeColor.Black, 0.2, offsetX: 3, offsetY: 4);

OfficeTransform stores affine transform intent in local top-left coordinates. Renderers can map it into PDF graphics state matrices, Open XML drawing transforms, or other format-native transform models.

var rotated = OfficeTransform.RotateDegrees(15, centerX: 60, centerY: 20);
var movedAndScaled = OfficeTransform.Translate(12, 4).Then(OfficeTransform.Scale(1.2, 1.2));

OfficeClipPath stores reusable local clipping intent for rectangles, rounded rectangles, and freeform paths. Renderers can map it to PDF clipping paths, Open XML masks, or another format-native clipping mechanism.

badge.ClipPath = OfficeClipPath.RoundedRectangle(120, 36, 8);

OfficeDrawing groups positioned shapes into a reusable local canvas. This is useful for logos, badges, simple diagrams, and future Office exporters that need to pass drawing intent into a format-specific renderer.

using OfficeIMO.Drawing;

var background = OfficeShape.Rectangle(120, 60);
background.FillColor = OfficeColor.WhiteSmoke;

var connector = OfficeShape.Line(0, 0, 120, 60);
connector.StrokeColor = OfficeColor.SteelBlue;

var marker = OfficeShape.Polygon(
    new OfficePoint(0, 30),
    new OfficePoint(40, 0),
    new OfficePoint(80, 30));
marker.FillColor = OfficeColor.SteelBlue;

var scene = new OfficeDrawing(120, 60)
    .AddShape(background, 0, 0)
    .AddShape(connector, 0, 0)
    .AddShape(marker, 20, 15);

PDF, Word, Excel, PowerPoint, and other packages can map these shared descriptors into their own drawing models while keeping serialization details inside the format-specific package.

Product 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on OfficeIMO.Drawing:

Package Downloads
OfficeIMO.Word

An Open Source cross-platform .NET library providing an easy way to create Microsoft Word (DocX) documents.

OfficeIMO.Excel

An Open Source cross-platform .NET library providing an easy way to create Excel documents.

OfficeIMO.Word.Markdown

Markdown converter for OfficeIMO.Word - Convert Word documents to/from Markdown using OfficeIMO.Markdown

OfficeIMO.Word.Html

HTML converter for OfficeIMO.Word - Convert Word documents to/from HTML using AngleSharp

OfficeIMO.Pdf

Dependency-free PDF builder and reader for .NET with fluent document composition, standard PDF fonts, basic layout primitives, and no runtime package dependencies.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on OfficeIMO.Drawing:

Repository Stars
EvotecIT/PSWriteOffice
PowerShell Module to create and edit Microsoft Word, Microsoft Excel, and Microsoft PowerPoint documents without having Microsoft Office installed.
Version Downloads Last Updated
1.0.13 987 5/27/2026
1.0.12 629 5/26/2026
1.0.11 561 5/26/2026
1.0.10 963 5/23/2026
1.0.9 579 5/22/2026
1.0.8 551 5/21/2026
1.0.7 547 5/21/2026
1.0.6 617 5/20/2026
1.0.5 587 5/19/2026
1.0.4 608 5/18/2026
1.0.3 845 5/16/2026
1.0.2 558 5/14/2026
1.0.1 795 5/14/2026
1.0.0 1,744 5/7/2026