NanoXLSX.Formatting 3.0.0
Loading...
Searching...
No Matches
NanoXLSX.FormattedText Class Reference

Represents a formatted text entry in Excel shared strings, supporting rich text with multiple runs and inline styles. More...

Inheritance diagram for NanoXLSX.FormattedText:

Public Member Functions

FormattedText AddRun (string text, Font fontStyle=null)
 Adds a text run with the specified style.
FormattedText AddRun (string text, Action< InlineStyleBuilder > styleBuilder)
 Adds a text run using a style builder for inline configuration.
void AddLineBreak (bool useStyleFromLastRun=true)
 Adds a line break to the formatted text. By default, the last run's style is used.
FormattedText AddPhoneticRun (string text, uint startBase, uint endBase)
 Adds a phonetic run for pronunciation guidance (Ruby text, like Furigana, Pinyin or Zhuyin).
FormattedText SetPhoneticProperties (Font fontReference, PhoneticRun.PhoneticType type=PhoneticRun.PhoneticType.FullwidthKatakana, PhoneticRun.PhoneticAlignment alignment=PhoneticRun.PhoneticAlignment.Left)
 Sets the phonetic properties for this formatted text, applied to the phonetic run (Ruby text).
void Clear ()
 Clears all runs from this formatted text.
FormattedText Copy ()
 Creates a deep copy of this FormattedText instance.
override string ToString ()
 Gets the string representation of the formatted text without formatting (plain text). The method is synonymous to the PlainText property.
override bool Equals (object obj)
 Equals method override for comparing two FormattedText instances.
override int GetHashCode ()
 GetHashCode method override for FormattedText.

Static Public Attributes

static readonly Style LineBreakStyle
 Style to be used for line breaks in formatted text.

Properties

bool WrapText [get, set]
 Gets or sets whether the runs should be rendered with text wrapping, if there are line breaks present.
IReadOnlyList< TextRunRuns [get]
 The list of text runs in this formatted text.
IReadOnlyList< PhoneticRunPhoneticRuns [get]
 The list of phonetic runs (Ruby text) in this formatted text.
PhoneticProperties PhoneticProperties [get, set]
 Phonetic properties for the formatted text (Phonetic run / Ruby text).
string PlainText [get]
 Gets the plain text content by concatenating all runs.

Detailed Description

Represents a formatted text entry in Excel shared strings, supporting rich text with multiple runs and inline styles.

Definition at line 25 of file FormattedText.cs.

Member Function Documentation

◆ AddLineBreak()

void NanoXLSX.FormattedText.AddLineBreak ( bool useStyleFromLastRun = true)

Adds a line break to the formatted text. By default, the last run's style is used.

Parameters
useStyleFromLastRunIf set to false, a new run without style will be created for the line break

Definition at line 127 of file FormattedText.cs.

◆ AddPhoneticRun()

FormattedText NanoXLSX.FormattedText.AddPhoneticRun ( string text,
uint startBase,
uint endBase )

Adds a phonetic run for pronunciation guidance (Ruby text, like Furigana, Pinyin or Zhuyin).

Parameters
textThe phonetic text (Ruby text)
startBaseThe start index of the base text (character where the Ruby text starts)
endBaseThe end index of the base text (character where the Ruby text ends)
Returns
The current FormattedText instance for method chaining

Definition at line 147 of file FormattedText.cs.

◆ AddRun() [1/2]

FormattedText NanoXLSX.FormattedText.AddRun ( string text,
Action< InlineStyleBuilder > styleBuilder )

Adds a text run using a style builder for inline configuration.

Parameters
textThe text content of the run
styleBuilderAn action to configure the inline style using an InlineStyleBuilder
Returns
The current FormattedText instance for method chaining

Definition at line 110 of file FormattedText.cs.

◆ AddRun() [2/2]

FormattedText NanoXLSX.FormattedText.AddRun ( string text,
Font fontStyle = null )

Adds a text run with the specified style.

Parameters
textThe text content of the run
fontStyleThe font style to apply to the run (optional)
Returns
The current FormattedText instance for method chaining

Definition at line 93 of file FormattedText.cs.

◆ Clear()

void NanoXLSX.FormattedText.Clear ( )

Clears all runs from this formatted text.

Definition at line 173 of file FormattedText.cs.

◆ Copy()

FormattedText NanoXLSX.FormattedText.Copy ( )

Creates a deep copy of this FormattedText instance.

Returns
The copied FormattedText instance

Definition at line 185 of file FormattedText.cs.

◆ Equals()

override bool NanoXLSX.FormattedText.Equals ( object obj)

Equals method override for comparing two FormattedText instances.

Parameters
objOther object to compare
Returns
True, if the other object is equal

Definition at line 512 of file FormattedText.cs.

◆ GetHashCode()

override int NanoXLSX.FormattedText.GetHashCode ( )

GetHashCode method override for FormattedText.

Returns
Hash code of the current object

Definition at line 528 of file FormattedText.cs.

◆ SetPhoneticProperties()

FormattedText NanoXLSX.FormattedText.SetPhoneticProperties ( Font fontReference,
PhoneticRun.PhoneticType type = PhoneticRun::PhoneticType::FullwidthKatakana,
PhoneticRun.PhoneticAlignment alignment = PhoneticRun::PhoneticAlignment::Left )

Sets the phonetic properties for this formatted text, applied to the phonetic run (Ruby text).

Parameters
fontReferenceThe font reference that is used to render the phonetic run (Ruby text)
typeThe phonetic type
alignmentThe phonetic alignment
Returns
The current FormattedText instance for method chaining

Definition at line 160 of file FormattedText.cs.

◆ ToString()

override string NanoXLSX.FormattedText.ToString ( )

Gets the string representation of the formatted text without formatting (plain text). The method is synonymous to the PlainText property.

Returns
Plain text of the formatted text

Definition at line 208 of file FormattedText.cs.

Member Data Documentation

◆ LineBreakStyle

readonly Style NanoXLSX.FormattedText.LineBreakStyle
static

Style to be used for line breaks in formatted text.

Definition at line 44 of file FormattedText.cs.

Property Documentation

◆ PhoneticProperties

PhoneticProperties NanoXLSX.FormattedText.PhoneticProperties
getset

Phonetic properties for the formatted text (Phonetic run / Ruby text).

Definition at line 77 of file FormattedText.cs.

◆ PhoneticRuns

IReadOnlyList<PhoneticRun> NanoXLSX.FormattedText.PhoneticRuns
get

The list of phonetic runs (Ruby text) in this formatted text.

Definition at line 73 of file FormattedText.cs.

◆ PlainText

string NanoXLSX.FormattedText.PlainText
get

Gets the plain text content by concatenating all runs.

Definition at line 82 of file FormattedText.cs.

◆ Runs

IReadOnlyList<TextRun> NanoXLSX.FormattedText.Runs
get

The list of text runs in this formatted text.

Definition at line 69 of file FormattedText.cs.

◆ WrapText

bool NanoXLSX.FormattedText.WrapText
getset

Gets or sets whether the runs should be rendered with text wrapping, if there are line breaks present.

Remarks
The actual style component, responsible for rendering wrapped texts within a cell, is only added when saving the workbook

Definition at line 64 of file FormattedText.cs.


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