NanoXLSX.Core 3.0.0-rc.3
Loading...
Searching...
No Matches
NanoXLSX.Styles.StyleRepository Class Reference

Class to manage all styles at runtime, before writing XLSX files. The main purpose is deduplication and decoupling of styles from workbooks at runtime. More...

Public Member Functions

Style AddStyle (Style style)
 Adds a style to the repository and returns the actual reference.
void FlushStyles ()
 Empties the static repository.

Properties

static StyleRepository Instance [get]
 Gets the singleton instance of the repository.
Dictionary< int, StyleStyles [get]
 Gets the currently managed styles of the repository.

Detailed Description

Class to manage all styles at runtime, before writing XLSX files. The main purpose is deduplication and decoupling of styles from workbooks at runtime.

Remarks
Be careful when changing style data in this class. It may lead to inconsistencies

Definition at line 16 of file StyleRepository.cs.

Member Function Documentation

◆ AddStyle()

Style NanoXLSX.Styles.StyleRepository.AddStyle ( Style style)

Adds a style to the repository and returns the actual reference.

Parameters
styleStyle to add
Returns
Reference from the repository. If the style to add already existed, the existing object is returned, otherwise the newly added one

Definition at line 59 of file StyleRepository.cs.

◆ FlushStyles()

void NanoXLSX.Styles.StyleRepository.FlushStyles ( )

Empties the static repository.

Remarks
Do not use this maintenance method while writing data on a worksheet or workbook. It will lead to invalid style data or even exceptions.
Only use this method after all worksheets in all workbooks are disposed.It may free memory then.

Definition at line 82 of file StyleRepository.cs.

Property Documentation

◆ Instance

StyleRepository NanoXLSX.Styles.StyleRepository.Instance
staticget

Gets the singleton instance of the repository.

Definition at line 25 of file StyleRepository.cs.

◆ Styles

Dictionary<int, Style> NanoXLSX.Styles.StyleRepository.Styles
get

Gets the currently managed styles of the repository.

Definition at line 44 of file StyleRepository.cs.


The documentation for this class was generated from the following file: