# OfficeRichTextRun

Describes one styled text run for shared rich text layout and rendering.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

[OfficeRichTextRun.cs:35](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L35)

**Modifiers**

sealed

Describes one styled text run for shared rich text layout and rendering.

## Inheritance

- object
- OfficeRichTextRun

## Usage

Explore 15 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 7

- Property [OfficeDrawingRichText.Runs](/api/core/officeimo-drawing-officedrawingrichtext/#property-runs)
- Property [OfficeRichTextParagraph.Runs](/api/core/officeimo-drawing-officerichtextparagraph/#property-runs)
- Method [OfficeRichTextRun.WithAutomaticPairKerningThreshold](/api/core/officeimo-drawing-officerichtextrun/#method-withautomaticpairkerningthreshold-nullable-system-double)
- Method [OfficeRichTextRun.WithLanguageId](/api/core/officeimo-drawing-officerichtextrun/#method-withlanguageid-nullable-system-uint32)
- Method [OfficeRichTextRun.WithParagraphIndent](/api/core/officeimo-drawing-officerichtextrun/#method-withparagraphindent-officeimo-drawing-officetextparagraphindent)
- Method [OfficeRichTextRun.WithTextCase](/api/core/officeimo-drawing-officerichtextrun/#method-withtextcase-officeimo-drawing-officetextcase-globalization-cultureinfo)
- Property [OfficeTextParagraphLabel.Run](/api/core/officeimo-drawing-officetextparagraphlabel/#property-run)

### Accepted by parameters 8

- Method [OfficeDrawing.AddRichText](/api/core/officeimo-drawing-officedrawing/#method-addrichtext-collections-generic-ireadonlylist-officeimo-drawing-officerichtextrun-double-double-double-double-officeimo-drawing-officetextalignment-nullable-system-double-officeimo-drawing-officetextverticalalignment-double-nullable-system-double-nullable-system-double-boolean-boolean-boolean-boolean-nullable-officeimo-drawing-officetextpadding-nullable-officeimo-drawing-officetextparagraphindent) parameter `runs`
- Method [OfficeDrawing.AddRichTextBehindContent](/api/core/officeimo-drawing-officedrawing/#method-addrichtextbehindcontent-collections-generic-ireadonlylist-officeimo-drawing-officerichtextrun-double-double-double-double-officeimo-drawing-officetextalignment-nullable-system-double-officeimo-drawing-officetextverticalalignment-double-nullable-system-double-nullable-system-double-boolean-boolean-boolean-boolean-nullable-officeimo-drawing-officetextpadding-nullable-officeimo-drawing-officetextparagraphindent) parameter `runs`
- Constructor [OfficeDrawingRichText.OfficeDrawingRichText](/api/core/officeimo-drawing-officedrawingrichtext/#constructor-ctor-collections-generic-ireadonlylist-officeimo-drawing-officerichtextrun-double-double-double-double-officeimo-drawing-officetextalignment-nullable-system-double-officeimo-drawing-officetextverticalalignment-double-nullable-system-double-nullable-system-double-boolean-boolean-boolean-boolean-nullable-officeimo-drawing-officetextpadding-nullable-officeimo-drawing-officetextparagraphindent) parameter `runs`
- Constructor [OfficeRichTextParagraph.OfficeRichTextParagraph](/api/core/officeimo-drawing-officerichtextparagraph/#constructor-ctor-collections-generic-ireadonlylist-officeimo-drawing-officerichtextrun-officeimo-drawing-officetextalignment-nullable-system-double-nullable-officeimo-drawing-officetextpadding-nullable-officeimo-drawing-officetextparagraphindent-nullable-system-double) parameter `runs`
- Method [OfficeTextLayoutEngine.LayoutRichTextBlock](/api/core/officeimo-drawing-officetextlayoutengine/#method-layoutrichtextblock-collections-generic-ireadonlylist-officeimo-drawing-officerichtextrun-double-double-double-func-system-string-system-double-system-double-boolean-boolean-double-nullable-officeimo-drawing-officetextparagraphindent) parameter `runs`
- Method [OfficeTextLayoutEngine.LayoutStackedRichTextBlock](/api/core/officeimo-drawing-officetextlayoutengine/#method-layoutstackedrichtextblock-collections-generic-ireadonlylist-officeimo-drawing-officerichtextrun-double-double-double-func-system-string-system-double-system-double-boolean-double) parameter `runs`
- Method [OfficeTextParagraphLabel.AtPosition](/api/core/officeimo-drawing-officetextparagraphlabel/#method-atposition-officeimo-drawing-officerichtextrun-double-officeimo-drawing-officetextalignment-officeimo-drawing-officetextparagraphlabelfollowedby-nullable-system-double) parameter `run`
- Method [OfficeTextParagraphLabel.InBox](/api/core/officeimo-drawing-officetextparagraphlabel/#method-inbox-officeimo-drawing-officerichtextrun-double-double-officeimo-drawing-officetextalignment-double) parameter `run`

Filter members 

Show inherited

## Constructors

OfficeRichTextRun 3 overloads

`public OfficeRichTextRun(string? text, double fontSize, OfficeColor color, bool bold, bool italic, bool underline, string? fontFamily, bool strikethrough, OfficeColor? backgroundColor)` [#](#constructor-ctor-string-double-officeimo-officecolor-boolean-boolean-boolean-string-boolean-nullable-officeimo-officecolor)

[OfficeRichTextRun.cs:35](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L35)

Creates a styled text run using the pre-typography constructor signature.

Parameters

**text string? required**

**fontSize double required**

**color OfficeIMO.OfficeColor required**

**bold bool required**

**italic bool required**

**underline bool required**

**fontFamily string? required**

**strikethrough bool required**

**backgroundColor OfficeIMO.OfficeColor? required**

`public OfficeRichTextRun(string? text, double fontSize, OfficeColor color, bool bold = false, bool italic = false, bool underline = false, string? fontFamily = null, bool strikethrough = false, OfficeColor? backgroundColor = null, OfficeTextDecorationStyle underlineStyle = None, OfficeTextDecorationStyle strikethroughStyle = None, OfficeTextBaseline baseline = Normal)` [#](#member-4297546706f4d2f58eea17a5)

[OfficeRichTextRun.cs:55](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L55)

Creates a styled text run.

Parameters

**text string? required**

Run text.

**fontSize double required**

Font size used for measurement and rendering.

**color OfficeIMO.OfficeColor required**

Text color.

**bold bool = false optional**

Whether the run should render as bold.

**italic bool = false optional**

Whether the run should render as italic.

**underline bool = false optional**

Whether the run should render with underline.

**fontFamily string? = null optional**

Preferred font family for SVG or future font-aware renderers.

**strikethrough bool = false optional**

Whether the run should render with strikethrough.

**backgroundColor OfficeIMO.OfficeColor? = null optional**

Optional run background/highlight color.

**underlineStyle OfficeIMO.Drawing.OfficeTextDecorationStyle = None optional**

Underline pattern. A non-none value takes precedence over underline.

**strikethroughStyle OfficeIMO.Drawing.OfficeTextDecorationStyle = None optional**

Strikethrough pattern. A non-none value takes precedence over strikethrough.

**baseline OfficeIMO.Drawing.OfficeTextBaseline = Normal optional**

Vertical baseline placement.

`public OfficeRichTextRun(string? text, double fontSize, OfficeColor color, bool bold, bool italic, bool underline, string? fontFamily, bool strikethrough, OfficeColor? backgroundColor, OfficeTextDecorationStyle underlineStyle, OfficeTextDecorationStyle strikethroughStyle, OfficeTextBaseline baseline, OfficeTextParagraphIndent? paragraphIndent)` [#](#member-e962426bb8d636df20d2e80a)

[OfficeRichTextRun.cs:73](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L73)

Creates a styled text run with an optional per-paragraph indentation override.

Parameters

**text string? required**

Run text.

**fontSize double required**

Font size used for measurement and rendering.

**color OfficeIMO.OfficeColor required**

Text color.

**bold bool required**

Whether the run should render as bold.

**italic bool required**

Whether the run should render as italic.

**underline bool required**

Whether the run should render with underline.

**fontFamily string? required**

Preferred font family.

**strikethrough bool required**

Whether the run should render with strikethrough.

**backgroundColor OfficeIMO.OfficeColor? required**

Optional run background color.

**underlineStyle OfficeIMO.Drawing.OfficeTextDecorationStyle required**

Underline pattern.

**strikethroughStyle OfficeIMO.Drawing.OfficeTextDecorationStyle required**

Strikethrough pattern.

**baseline OfficeIMO.Drawing.OfficeTextBaseline required**

Vertical baseline placement.

**paragraphIndent OfficeIMO.Drawing.OfficeTextParagraphIndent? required**

Indentation for a paragraph beginning at this run or after its line break.

## Methods

`public OfficeRichTextRun WithAutomaticPairKerningThreshold(double? thresholdPoints)` [#](#method-withautomaticpairkerningthreshold-nullable-system-double)

[OfficeRichTextRun.cs:23](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L23)

Returns an independent run with a native pair-kerning threshold. Null leaves the setting unspecified; zero explicitly disables it.

Parameters

**thresholdPoints double? required**

A finite, nonnegative point size, or null. A native writer may impose a narrower representable range.

Returns

`OfficeRichTextRun`

`public OfficeRichTextRun WithLanguageId(uint? languageId)` [#](#method-withlanguageid-nullable-system-uint32)

[OfficeRichTextRun.cs:165](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L165)

Creates a copy with an explicit 16-bit language identifier, or an unspecified language when null. All text, styling and annotations are retained.

Parameters

**languageId uint? required**

Returns

`OfficeRichTextRun`

`public OfficeRichTextRun WithParagraphIndent(OfficeTextParagraphIndent paragraphIndent)` [#](#method-withparagraphindent-officeimo-drawing-officetextparagraphindent)

[OfficeRichTextRun.cs:174](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L174)

Creates a styled copy that starts a paragraph with its own indentation.

Parameters

**paragraphIndent OfficeIMO.Drawing.OfficeTextParagraphIndent required**

Returns

`OfficeRichTextRun`

`public OfficeRichTextRun WithTextCase(OfficeTextCase textCase, CultureInfo? culture = null)` [#](#method-withtextcase-officeimo-drawing-officetextcase-globalization-cultureinfo)

[OfficeRichTextRun.cs:179](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L179)

Creates a copy with transformed text casing while preserving all drawing styles.

Parameters

**textCase OfficeIMO.Drawing.OfficeTextCase required**

**culture System.Globalization.CultureInfo? = null optional**

Returns

`OfficeRichTextRun`

## 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 double? AutomaticPairKerningThreshold { get; internal set; }` [#](#property-automaticpairkerningthreshold)

[OfficeRichTextRun.cs:11](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L11)

Native automatic pair-kerning threshold, in points. Zero disables pair kerning; null leaves the native setting unspecified.

`public string Text { get; }` [#](#property-text)

[OfficeRichTextRun.cs:103](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L103)

Gets the run text.

`public double FontSize { get; }` [#](#property-fontsize)

[OfficeRichTextRun.cs:108](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L108)

Gets the run font size.

`public OfficeColor Color { get; }` [#](#property-color)

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

Gets the run text color.

`public bool Bold { get; }` [#](#property-bold)

[OfficeRichTextRun.cs:118](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L118)

Gets whether the run should render as bold.

`public bool Italic { get; }` [#](#property-italic)

[OfficeRichTextRun.cs:123](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L123)

Gets whether the run should render as italic.

`public bool Underline { get; }` [#](#property-underline)

[OfficeRichTextRun.cs:128](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L128)

Gets whether the run should render with underline.

`public OfficeTextDecorationStyle UnderlineStyle { get; }` [#](#property-underlinestyle)

[OfficeRichTextRun.cs:131](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L131)

Gets the underline line pattern.

`public bool Strikethrough { get; }` [#](#property-strikethrough)

[OfficeRichTextRun.cs:136](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L136)

Gets whether the run should render with strikethrough.

`public OfficeTextDecorationStyle StrikethroughStyle { get; }` [#](#property-strikethroughstyle)

[OfficeRichTextRun.cs:139](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L139)

Gets the strikethrough line pattern.

`public OfficeTextBaseline Baseline { get; }` [#](#property-baseline)

[OfficeRichTextRun.cs:142](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L142)

Gets the vertical baseline placement.

`public double EffectiveFontSize { get; }` [#](#property-effectivefontsize)

[OfficeRichTextRun.cs:145](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L145)

Gets the effective font size used for measuring and rendering this run.

`public string FontFamily { get; }` [#](#property-fontfamily)

[OfficeRichTextRun.cs:150](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L150)

Gets the preferred font family for SVG or future font-aware renderers.

`public OfficeColor? BackgroundColor { get; }` [#](#property-backgroundcolor)

[OfficeRichTextRun.cs:155](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L155)

Gets the optional run background/highlight color.

`public OfficeTextParagraphIndent? ParagraphIndent { get; }` [#](#property-paragraphindent)

[OfficeRichTextRun.cs:158](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L158)

Optional first-line and continuation offsets for the paragraph beginning at this run.

`public uint? LanguageId { get; internal set; }` [#](#property-languageid)

[OfficeRichTextRun.cs:161](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextRun.cs#L161)

Optional Windows language identifier for native document adapters. Null leaves language unspecified; it does not request removal of an imported override. When an adapter enables automatic hyphenation, supported language identifiers select the shared versioned pattern resources.

<!-- PowerForge markdown artifact sha256:125697B3920EA7BF3DE92C69074F68017A399679B61F0CF89034C82453EDEF05 -->
