# OdfStyleRepository

Indexes and creates named and automatic ODF styles without detaching them from package XML.

Class 

`OfficeIMO.OpenDocument`

**Namespace**

`OfficeIMO.OpenDocument`

**Assembly**

`OfficeIMO.OpenDocument`

**Source revision**

`be6c300e4ab1` with working tree changes

**Source**

[OdfStyleRepository.cs:31](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.cs#L31)

**Modifiers**

sealed

Indexes and creates named and automatic ODF styles without detaching them from package XML.

## Inheritance

- object
- OdfStyleRepository

## Usage

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

- Property [OdfDocument.Styles](/api/open-document/officeimo-opendocument-odfdocument/#property-styles)
- Property [OdgDocument.Styles](/api/open-document/officeimo-opendocument-odgdocument/#property-styles)
- Property [OdpPresentation.Styles](/api/open-document/officeimo-opendocument-odppresentation/#property-styles)
- Property [OdsDocument.Styles](/api/open-document/officeimo-opendocument-odsdocument/#property-styles)
- Property [OdtDocument.Styles](/api/open-document/officeimo-opendocument-odtdocument/#property-styles)

Filter members 

Show inherited

## Methods

`public OdfStyle CreateAutomatic(OdfStyleFamily family, string prefix = "of", string? parentStyleName = null)` [#](#method-createautomatic-officeimo-opendocument-odfstylefamily-string-string)

[OdfStyleRepository.cs:76](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.cs#L76)

Creates a collision-free automatic style in content.xml.

Parameters

**family OfficeIMO.OpenDocument.OdfStyleFamily required**

**prefix string = "of" optional**

**parentStyleName string? = null optional**

Returns

`OdfStyle`

`public OdfDataStyle CreateDateStyle(string name)` [#](#method-createdatestyle-string)

[OdfStyleRepository.DataStyles.cs:30](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.DataStyles.cs#L30)

Creates a common Gregorian ISO year-month-day style usable by any ODF document.

Parameters

**name string required**

Returns

`OdfDataStyle`

`public OdfGradient CreateGradient(string name, OdfGradientPattern pattern)` [#](#method-creategradient-string-officeimo-opendocument-odfgradientpattern)

[OdfStyleRepository.Gradients.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.Gradients.cs#L15)

Creates a reusable native two-color gradient in common styles.

Parameters

**name string required**

**pattern OfficeIMO.OpenDocument.OdfGradientPattern required**

Returns

`OdfGradient`

`public OdfMarker CreateMarker(string name, OdfMarkerGeometry geometry)` [#](#method-createmarker-string-officeimo-opendocument-odfmarkergeometry)

[OdfStyleRepository.Markers.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.Markers.cs#L15)

Creates reusable native marker geometry in common styles.

Parameters

**name string required**

**geometry OfficeIMO.OpenDocument.OdfMarkerGeometry required**

Returns

`OdfMarker`

`public OdfStyle CreateNamed(string name, OdfStyleFamily family, string? parentStyleName = null)` [#](#method-createnamed-string-officeimo-opendocument-odfstylefamily-string)

[OdfStyleRepository.cs:63](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.cs#L63)

Creates a common named style in styles.xml.

Parameters

**name string required**

**family OfficeIMO.OpenDocument.OdfStyleFamily required**

**parentStyleName string? = null optional**

Returns

`OdfStyle`

`public OdfStrokeDash CreateStrokeDash(string name, OdfStrokeDashPattern pattern)` [#](#method-createstrokedash-string-officeimo-opendocument-odfstrokedashpattern)

[OdfStyleRepository.StrokeDashes.cs:15](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.StrokeDashes.cs#L15)

Creates a named dash pattern shared by shapes that reference it.

Parameters

**name string required**

**pattern OfficeIMO.OpenDocument.OdfStrokeDashPattern required**

Returns

`OdfStrokeDash`

`public OdfDataStyle CreateTimeStyle(string name)` [#](#method-createtimestyle-string)

[OdfStyleRepository.DataStyles.cs:33](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.DataStyles.cs#L33)

Creates a common 24-hour clock style with hours, minutes and seconds.

Parameters

**name string required**

Returns

`OdfDataStyle`

`public OdfStyle? Find(OdfStyleFamily family, string name)` [#](#method-find-officeimo-opendocument-odfstylefamily-string)

[OdfStyleRepository.cs:31](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.cs#L31)

Finds a style by family and name, preferring content automatic styles.

Parameters

**family OfficeIMO.OpenDocument.OdfStyleFamily required**

**name string required**

Returns

`OdfStyle?`

`public OdfDataStyle? FindDataStyle(string name, string partPath = "content.xml")` [#](#method-finddatastyle-string-string)

[OdfStyleRepository.DataStyles.cs:6](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.DataStyles.cs#L6)

Finds a data style in the requested part's automatic styles, then common styles. Duplicate names are rejected.

Parameters

**name string required**

**partPath string = "content.xml" optional**

Returns

`OdfDataStyle?`

`public OdfGradient? FindGradient(string name)` [#](#method-findgradient-string)

[OdfStyleRepository.Gradients.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.Gradients.cs#L8)

Finds a gradient, rejecting duplicate names across native and SVG gradient definitions.

Parameters

**name string required**

Returns

`OdfGradient?`

`public OdfMarker? FindMarker(string name)` [#](#method-findmarker-string)

[OdfStyleRepository.Markers.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.Markers.cs#L8)

Finds a marker, rejecting ambiguous duplicate names.

Parameters

**name string required**

Returns

`OdfMarker?`

`public OdfStrokeDash? FindStrokeDash(string name)` [#](#method-findstrokedash-string)

[OdfStyleRepository.StrokeDashes.cs:8](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.StrokeDashes.cs#L8)

Finds a named dash definition, rejecting ambiguous duplicate names.

Parameters

**name string required**

Returns

`OdfStrokeDash?`

`public IReadOnlyList<OdfStyle> Resolve(OdfStyle style)` [#](#method-resolve-officeimo-opendocument-odfstyle)

[OdfStyleRepository.cs:106](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.cs#L106)

Resolves a style and its parent chain from most specific to least specific.

Parameters

**style OfficeIMO.OpenDocument.OdfStyle required**

Returns

`IReadOnlyList<OdfStyle>`

## 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 IReadOnlyList<OdfStyle> Named { get; }` [#](#property-named)

[OdfStyleRepository.cs:17](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.cs#L17)

Enumerates common styles from styles.xml.

`public IReadOnlyList<OdfStyle> Automatic { get; }` [#](#property-automatic)

[OdfStyleRepository.cs:22](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.cs#L22)

Enumerates automatic styles from both content.xml and styles.xml.

`public IReadOnlyList<OdfGradient> Gradients { get; }` [#](#property-gradients)

[OdfStyleRepository.Gradients.cs:5](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.Gradients.cs#L5)

Named native and SVG gradient definitions in common styles.

`public IReadOnlyList<OdfMarker> Markers { get; }` [#](#property-markers)

[OdfStyleRepository.Markers.cs:5](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.Markers.cs#L5)

Named marker definitions in common styles.

`public IReadOnlyList<OdfStrokeDash> StrokeDashes { get; }` [#](#property-strokedashes)

[OdfStyleRepository.StrokeDashes.cs:5](https://github.com/EvotecIT/OfficeIMO/blob/be6c300e4ab1859837b961c64fbfb2b2a1886cd0/Sources/OfficeIMO.OpenDocument/Styles/OdfStyleRepository.StrokeDashes.cs#L5)

Named stroke-dash definitions in common styles.

<!-- PowerForge markdown artifact sha256:64DC15F6E9FCFE8115C7EAB235B7F97113BC3F5131B66216E1109176AA913A4B -->
