# OfficeRichTextSegment

Describes one measured rich text segment on a laid-out line.

Class 

`OfficeIMO.Drawing`

**Namespace**

`OfficeIMO.Drawing`

**Assembly**

`OfficeIMO.Core`

**Source revision**

`ba882f6b0d07` with working tree changes

**Source**

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

**Modifiers**

sealed

Describes one measured rich text segment on a laid-out line.

## Inheritance

- object
- OfficeRichTextSegment

## Usage

Explore 3 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 1

- Property [OfficeRichTextLine.Segments](/api/core/officeimo-drawing-officerichtextline/#property-segments)

### Accepted by parameters 2

- Constructor [OfficeRichTextLine.OfficeRichTextLine](/api/core/officeimo-drawing-officerichtextline/#constructor-ctor-collections-generic-ireadonlylist-officeimo-drawing-officerichtextsegment) parameter `segments`
- Method [OfficeTextBlockRenderer.AppendSvgRichTextSegment](/api/core/officeimo-drawing-officetextblockrenderer/#method-appendsvgrichtextsegment-text-stringbuilder-officeimo-drawing-officerichtextsegment-double-double-double-double-double) parameter `segment`

Filter members 

Show inherited

## Constructors

OfficeRichTextSegment 2 overloads

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

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

Creates a measured segment using the pre-typography constructor signature.

Parameters

**text string required**

**width double 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 OfficeRichTextSegment(string text, double width, double fontSize, OfficeColor color, bool bold, bool italic, bool underline, string fontFamily, bool strikethrough = false, OfficeColor? backgroundColor = null, OfficeTextDecorationStyle underlineStyle = None, OfficeTextDecorationStyle strikethroughStyle = None, OfficeTextBaseline baseline = Normal)` [#](#member-ad9abfffc022547b6eef4b81)

[OfficeRichTextSegment.cs:37](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L37)

Creates a measured rich text segment.

Parameters

**text string required**

**width double required**

**fontSize double required**

**color OfficeIMO.OfficeColor required**

**bold bool required**

**italic bool required**

**underline bool required**

**fontFamily string required**

**strikethrough bool = false optional**

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

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

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

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

## 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 string Text { get; }` [#](#property-text)

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

Gets the segment text.

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

[OfficeRichTextSegment.cs:68](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L68)

Gets the measured segment width.

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

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

Gets the segment font size.

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

[OfficeRichTextSegment.cs:78](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L78)

Gets the segment color.

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

[OfficeRichTextSegment.cs:83](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L83)

Gets whether the segment should render as bold.

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

[OfficeRichTextSegment.cs:88](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L88)

Gets whether the segment should render as italic.

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

[OfficeRichTextSegment.cs:93](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L93)

Gets whether the segment should render with underline.

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

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

Gets the underline line pattern.

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

[OfficeRichTextSegment.cs:101](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L101)

Gets whether the segment should render with strikethrough.

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

[OfficeRichTextSegment.cs:104](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L104)

Gets the strikethrough line pattern.

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

[OfficeRichTextSegment.cs:107](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L107)

Gets the vertical baseline placement.

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

[OfficeRichTextSegment.cs:112](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L112)

Gets the segment font family.

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

[OfficeRichTextSegment.cs:117](https://github.com/EvotecIT/OfficeIMO/blob/ba882f6b0d07acddd884b5e7d3086b0cfff0a05a/OfficeIMO.Core/OfficeRichTextSegment.cs#L117)

Gets the optional segment background/highlight color.

<!-- PowerForge markdown artifact sha256:56DF4DF8B5CAC742C0B6F01DD5CEE0726E0059F77FC6D86F54A1720FF8C6DE3E -->
