# OfficeTextBlockRenderPlan

Shared placement plan for renderers that draw a measured text block inside a center-based rectangle.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeTextBlockRenderPlan.cs:76](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L76)

**Modifiers**

sealed

Shared placement plan for renderers that draw a measured text block inside a center-based rectangle.

## Inheritance

- object
- OfficeTextBlockRenderPlan

## Usage

Explore 7 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

### Returned or exposed by 5

- Method [OfficeTextBlockRenderPlan.CreateFittedFromCenter](/api/core/officeimo-drawing-officetextblockrenderplan/#method-createfittedfromcenter-string-double-double-double-double-double-func-system-string-system-double-system-double-officeimo-drawing-officetextalignment-officeimo-drawing-officetextverticalalignment-double-double)
- Method [OfficeTextBlockRenderPlan.CreateFromCenter](/api/core/officeimo-drawing-officetextblockrenderplan/#method-createfromcenter-officeimo-drawing-officetextblocklayout-double-double-double-double-officeimo-drawing-officetextalignment-officeimo-drawing-officetextverticalalignment)
- Method [OfficeTextBlockRenderPlan.CreateFromRectangle](/api/core/officeimo-drawing-officetextblockrenderplan/#method-createfromrectangle-officeimo-drawing-officetextblocklayout-double-double-double-double-officeimo-drawing-officetextalignment-officeimo-drawing-officetextverticalalignment)
- Method [OfficeTextBlockRenderPlan.CreateStackedTextBlockFromRectangle](/api/core/officeimo-drawing-officetextblockrenderplan/#method-createstackedtextblockfromrectangle-string-double-double-double-double-double-func-system-string-system-double-system-double-officeimo-drawing-officetextalignment-officeimo-drawing-officetextverticalalignment-double-double-boolean)
- Method [OfficeTextBlockRenderPlan.CreateTextBlockFromRectangle](/api/core/officeimo-drawing-officetextblockrenderplan/#method-createtextblockfromrectangle-string-double-double-double-double-double-func-system-string-system-double-system-double-officeimo-drawing-officetextalignment-officeimo-drawing-officetextverticalalignment-double-double-boolean-boolean-boolean)

### Accepted by parameters 2

- Method [OfficeTextBlockRenderer.DrawRasterTextBox](/api/core/officeimo-drawing-officetextblockrenderer/#method-drawrastertextbox-officeimo-drawing-officerastercanvas-officeimo-drawing-officetextblockrenderplan-officeimo-officecolor-boolean-boolean-boolean-nullable-officeimo-drawing-officetextalignment-nullable-officeimo-drawing-officetextverticalalignment-double-double-double-nullable-officeimo-officecolor-double-double-boolean-double-boolean-string) parameter `plan`
- Method [OfficeTextBlockRenderer.WriteSvgTextBox](/api/core/officeimo-drawing-officetextblockrenderer/#method-writesvgtextbox-xml-xmlwriter-officeimo-drawing-officetextblockrenderplan-officeimo-officecolor-string-boolean-boolean-boolean-double-double-double-string-nullable-officeimo-officecolor-double-double-action-system-xml-xmlwriter-action-system-xml-xmlwriter-boolean-officeimo-drawing-officetextdecorationstyle-officeimo-drawing-officetextdecorationstyle-officeimo-drawing-officetextbaseline) parameter `plan`

Filter members 

Show inherited

## Methods

`public OfficeTextBlockBackgroundBounds CreateBackgroundBounds(double horizontalPadding, double verticalPadding)` [#](#method-createbackgroundbounds-double-double)

[OfficeTextBlockRenderPlan.cs:266](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L266)

Creates background bounds around the measured text block.

Parameters

**horizontalPadding double required**

**verticalPadding double required**

Returns

`OfficeTextBlockBackgroundBounds`

`public static OfficeTextBlockRenderPlan CreateFittedFromCenter(string? text, double fontSize, double centerX, double centerY, double width, double height, Func<string?, double, double> measure, OfficeTextAlignment horizontalAlignment = Left, OfficeTextVerticalAlignment verticalAlignment = Top, double lineHeightFactor = 1.2, double minimumFontSize = 5)` [#](#member-9eae3a95fe3779f2fbf54593)

[OfficeTextBlockRenderPlan.cs:113](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L113)

Measures wrapped text and creates a placement plan for a center-based rectangle.

Parameters

**text string? required**

**fontSize double required**

**centerX double required**

**centerY double required**

**width double required**

**height double required**

**measure System.Func<string?, double, double> required**

**horizontalAlignment OfficeIMO.Drawing.OfficeTextAlignment = Left optional**

**verticalAlignment OfficeIMO.Drawing.OfficeTextVerticalAlignment = Top optional**

**lineHeightFactor double = 1.2 optional**

**minimumFontSize double = 5 optional**

Returns

`OfficeTextBlockRenderPlan`

`public static OfficeTextBlockRenderPlan CreateFromCenter(OfficeTextBlockLayout layout, double centerX, double centerY, double width, double height, OfficeTextAlignment horizontalAlignment = Left, OfficeTextVerticalAlignment verticalAlignment = Top)` [#](#method-createfromcenter-officeimo-drawing-officetextblocklayout-double-double-double-double-officeimo-drawing-officetextalignment-officeimo-drawing-officetextverticalalignment)

[OfficeTextBlockRenderPlan.cs:76](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L76)

Creates a placement plan for an already measured layout.

Parameters

**layout OfficeIMO.Drawing.OfficeTextBlockLayout required**

**centerX double required**

**centerY double required**

**width double required**

**height double required**

**horizontalAlignment OfficeIMO.Drawing.OfficeTextAlignment = Left optional**

**verticalAlignment OfficeIMO.Drawing.OfficeTextVerticalAlignment = Top optional**

Returns

`OfficeTextBlockRenderPlan`

`public static OfficeTextBlockRenderPlan CreateFromRectangle(OfficeTextBlockLayout layout, double left, double top, double width, double height, OfficeTextAlignment horizontalAlignment = Left, OfficeTextVerticalAlignment verticalAlignment = Top)` [#](#method-createfromrectangle-officeimo-drawing-officetextblocklayout-double-double-double-double-officeimo-drawing-officetextalignment-officeimo-drawing-officetextverticalalignment)

[OfficeTextBlockRenderPlan.cs:96](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L96)

Creates a placement plan for an already measured layout inside a left/top-based rectangle.

Parameters

**layout OfficeIMO.Drawing.OfficeTextBlockLayout required**

**left double required**

**top double required**

**width double required**

**height double required**

**horizontalAlignment OfficeIMO.Drawing.OfficeTextAlignment = Left optional**

**verticalAlignment OfficeIMO.Drawing.OfficeTextVerticalAlignment = Top optional**

Returns

`OfficeTextBlockRenderPlan`

`public static OfficeTextBlockRenderPlan CreateStackedTextBlockFromRectangle(string? text, double fontSize, double left, double top, double width, double height, Func<string?, double, double> measure, OfficeTextAlignment horizontalAlignment = Center, OfficeTextVerticalAlignment verticalAlignment = Top, double lineHeightFactor = 1.2, double minimumFontSize = 5, bool shrinkToFit = false)` [#](#member-86dc87c07db0c3867ba65df3)

[OfficeTextBlockRenderPlan.cs:246](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L246)

Measures stacked text and creates a placement plan for a left/top-based rectangle.

Parameters

**text string? required**

**fontSize double required**

**left double required**

**top double required**

**width double required**

**height double required**

**measure System.Func<string?, double, double> required**

**horizontalAlignment OfficeIMO.Drawing.OfficeTextAlignment = Center optional**

**verticalAlignment OfficeIMO.Drawing.OfficeTextVerticalAlignment = Top optional**

**lineHeightFactor double = 1.2 optional**

**minimumFontSize double = 5 optional**

**shrinkToFit bool = false optional**

Returns

`OfficeTextBlockRenderPlan`

CreateTextBlockFromRectangle 2 overloads

`public static OfficeTextBlockRenderPlan CreateTextBlockFromRectangle(string? text, double fontSize, double left, double top, double width, double height, Func<string?, double, double> measure, OfficeTextAlignment horizontalAlignment = Left, OfficeTextVerticalAlignment verticalAlignment = Top, double lineHeightFactor = 1.2, double minimumFontSize = 5, bool wrap = false, bool forceSingleLine = false, bool shrinkToFit = false)` [#](#member-586b90a1f543b9375b57b925)

[OfficeTextBlockRenderPlan.cs:160](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L160)

Measures a text block and creates a placement plan for a left/top-based rectangle.

Parameters

**text string? required**

Text to lay out.

**fontSize double required**

Initial font size passed to measure.

**left double required**

Left edge of the available text rectangle.

**top double required**

Top edge of the available text rectangle.

**width double required**

Available text rectangle width.

**height double required**

Available text rectangle height.

**measure System.Func<string?, double, double> required**

Measurement delegate matching [OfficeRasterCanvas.MeasureText](/api/core/officeimo-drawing-officerastercanvas/).

**horizontalAlignment OfficeIMO.Drawing.OfficeTextAlignment = Left optional**

Horizontal alignment inside the rectangle.

**verticalAlignment OfficeIMO.Drawing.OfficeTextVerticalAlignment = Top optional**

Vertical alignment inside the rectangle.

**lineHeightFactor double = 1.2 optional**

Multiplier used to derive line height from font size.

**minimumFontSize double = 5 optional**

Minimum font size when shrink-to-fit is enabled.

**wrap bool = false optional**

Whether soft wrapping is enabled.

**forceSingleLine bool = false optional**

Whether line breaks should be normalized to spaces and wrapping disabled.

**shrinkToFit bool = false optional**

Whether single-line text should reduce font size to fit the requested width.

Returns

`OfficeTextBlockRenderPlan`

`public static OfficeTextBlockRenderPlan CreateTextBlockFromRectangle(string? text, double fontSize, double left, double top, double width, double height, Func<string?, double, double> measure, OfficeTextAlignment horizontalAlignment, OfficeTextVerticalAlignment verticalAlignment, double lineHeightFactor, double minimumFontSize, bool wrap, bool forceSingleLine, bool shrinkToFit, OfficeTextOverflowBehavior overflowBehavior)` [#](#member-eb2536e35a746a5ac7cd117a)

[OfficeTextBlockRenderPlan.cs:211](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L211)

Measures a text block and creates a placement plan for a left/top-based rectangle.

Parameters

**text string? required**

Text to lay out.

**fontSize double required**

Initial font size passed to measure.

**left double required**

Left edge of the available text rectangle.

**top double required**

Top edge of the available text rectangle.

**width double required**

Available text rectangle width.

**height double required**

Available text rectangle height.

**measure System.Func<string?, double, double> required**

Measurement delegate matching [OfficeRasterCanvas.MeasureText](/api/core/officeimo-drawing-officerastercanvas/).

**horizontalAlignment OfficeIMO.Drawing.OfficeTextAlignment required**

Horizontal alignment inside the rectangle.

**verticalAlignment OfficeIMO.Drawing.OfficeTextVerticalAlignment required**

Vertical alignment inside the rectangle.

**lineHeightFactor double required**

Multiplier used to derive line height from font size.

**minimumFontSize double required**

Minimum font size when shrink-to-fit is enabled.

**wrap bool required**

Whether soft wrapping is enabled.

**forceSingleLine bool required**

Whether line breaks should be normalized to spaces and wrapping disabled.

**shrinkToFit bool required**

Whether single-line text should reduce font size to fit the requested width.

**overflowBehavior OfficeIMO.Drawing.OfficeTextOverflowBehavior required**

How overflowing text should be represented in the returned layout.

Returns

`OfficeTextBlockRenderPlan`

## Inherited Methods

`public virtual bool Equals(object? obj)` [#](#method-equals-object)

Inherited from object

Parameters

**obj object? required**

Returns

`bool`

`public virtual int GetHashCode()` [#](#method-gethashcode)

Inherited from object

Returns

`int`

`public Type GetType()` [#](#method-gettype)

Inherited from object

Returns

`Type`

`public virtual string? ToString()` [#](#method-tostring)

Inherited from object

Returns

`string?`

## Properties

`public OfficeTextBlockLayout Layout { get; }` [#](#property-layout)

[OfficeTextBlockRenderPlan.cs:30](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L30)

Measured text layout.

`public double CenterX { get; }` [#](#property-centerx)

[OfficeTextBlockRenderPlan.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L33)

Center X of the available text rectangle.

`public double CenterY { get; }` [#](#property-centery)

[OfficeTextBlockRenderPlan.cs:36](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L36)

Center Y of the available text rectangle.

`public double Left { get; }` [#](#property-left)

[OfficeTextBlockRenderPlan.cs:39](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L39)

Left edge of the available text rectangle.

`public double Top { get; }` [#](#property-top)

[OfficeTextBlockRenderPlan.cs:42](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L42)

Top edge of the available text rectangle.

`public double Width { get; }` [#](#property-width)

[OfficeTextBlockRenderPlan.cs:45](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L45)

Width of the available text rectangle.

`public double Height { get; }` [#](#property-height)

[OfficeTextBlockRenderPlan.cs:48](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L48)

Height of the available text rectangle.

`public OfficeTextAlignment HorizontalAlignment { get; }` [#](#property-horizontalalignment)

[OfficeTextBlockRenderPlan.cs:51](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L51)

Horizontal alignment inside the available rectangle.

`public OfficeTextVerticalAlignment VerticalAlignment { get; }` [#](#property-verticalalignment)

[OfficeTextBlockRenderPlan.cs:54](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L54)

Vertical alignment inside the available rectangle.

`public double AnchorX { get; }` [#](#property-anchorx)

[OfficeTextBlockRenderPlan.cs:57](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L57)

Resolved X anchor used by line renderers.

`public double TextLeft { get; }` [#](#property-textleft)

[OfficeTextBlockRenderPlan.cs:60](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L60)

Resolved left edge of the measured text block.

`public double TextTop { get; }` [#](#property-texttop)

[OfficeTextBlockRenderPlan.cs:63](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeTextBlockRenderPlan.cs#L63)

Resolved top edge of the measured text block.

<!-- PowerForge markdown artifact sha256:48510CB0FD994CDBC47966B575CE01A30B3F4FDF1B116A2B983DF03D7D54F980 -->
