Table of Contents

Class OdfTextRun

Namespace
OdfKit.Text
Assembly
OdfKit.dll

Represents a text run (span) within a paragraph. 表示段落中的文字片段(Span)。

public class OdfTextRun
Inheritance
OdfTextRun
Inherited Members

Properties

BackgroundColor

Gets or sets the text run's background color. 取得或設定文字片段的背景色。

public string? BackgroundColor { get; set; }

Property Value

string

Color

Gets or sets the text run's font color. 取得或設定文字片段的字色。

public string? Color { get; set; }

Property Value

string

FontName

Gets or sets the text run's Western font name. 取得或設定文字片段的西文字型名稱。

public string? FontName { get; set; }

Property Value

string

FontNameAsian

Gets or sets the text run's East Asian (CJK) font name. 取得或設定文字片段的東亞(中日韓)字型名稱。

public string? FontNameAsian { get; set; }

Property Value

string

FontNameComplex

Gets or sets the text run's complex script font name. 取得或設定文字片段的複雜文字字型名稱。

public string? FontNameComplex { get; set; }

Property Value

string

FontSize

Gets or sets the text run's Western font size. 取得或設定文字片段的西文字型大小。

public string? FontSize { get; set; }

Property Value

string

FontSizeAsian

Gets or sets the text run's East Asian (CJK) font size. 取得或設定文字片段的東亞(中日韓)字型大小。

public string? FontSizeAsian { get; set; }

Property Value

string

FontSizeComplex

Gets or sets the text run's complex script font size. 取得或設定文字片段的複雜文字字型大小。

public string? FontSizeComplex { get; set; }

Property Value

string

FontVariant

Gets or sets the font variant, e.g. small-caps. 取得或設定字型變體,例如 small-caps

public string? FontVariant { get; set; }

Property Value

string

IsBold

Gets or sets a value indicating whether the text run is bold. 取得或設定一個值,指出文字片段是否為粗體。

public bool IsBold { get; set; }

Property Value

bool

IsItalic

Gets or sets a value indicating whether the text run is italic. 取得或設定一個值,指出文字片段是否為斜體。

public bool IsItalic { get; set; }

Property Value

bool

IsStrikethrough

Gets or sets a value indicating whether the text run has strikethrough. 取得或設定一個值,指出文字片段是否加上刪除線。

public bool IsStrikethrough { get; set; }

Property Value

bool

IsSubscript

Gets or sets a value indicating whether the text run is subscript. 取得或設定一個值,指出文字片段是否為下標。

public bool IsSubscript { get; set; }

Property Value

bool

IsSuperscript

Gets or sets a value indicating whether the text run is superscript. 取得或設定一個值,指出文字片段是否為上標。

public bool IsSuperscript { get; set; }

Property Value

bool

IsUnderline

Gets or sets a value indicating whether the text run is underlined. 取得或設定一個值,指出文字片段是否加上底線。

public bool IsUnderline { get; set; }

Property Value

bool

StyleName

Gets or sets the text run's style name. 取得或設定文字片段的樣式名稱。

public string? StyleName { get; set; }

Property Value

string

Text

Gets or sets the text run's content. 取得或設定文字片段的內文。

public string Text { get; set; }

Property Value

string

TextPosition

Gets or sets the text run's position, e.g. baseline, super, or sub. 取得或設定文字片段的位置,例如 baselinesupersub

public string? TextPosition { get; set; }

Property Value

string

TextTransform

Gets or sets the text case transform, e.g. uppercase. 取得或設定文字大小寫轉換,例如 uppercase

public string? TextTransform { get; set; }

Property Value

string

Methods

Delete()

Deletes this text run. 刪除此文字片段。

public void Delete()

SetFont(string)

Short overload of SetFont that accepts westernFont; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernFont;其餘可選參數使用預設值並轉呼叫最長 SetFont 多載。

public void SetFont(string westernFont)

Parameters

westernFont string

SetFont(string, string?)

Short overload of SetFont that accepts westernFont and asianFont; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernFont 與 asianFont;其餘可選參數使用預設值並轉呼叫最長 SetFont 多載。

public void SetFont(string westernFont, string? asianFont)

Parameters

westernFont string
asianFont string

SetFont(string, string?, string?)

Sets the text run's font names. 設定文字片段的字型名稱。

public void SetFont(string westernFont, string? asianFont, string? complexFont)

Parameters

westernFont string

The Western font name. / 西文字型名稱。

asianFont string

The East Asian (CJK) font name. / 東亞(中日韓)字型名稱。

complexFont string

The complex script font name. / 複雜文字字型名稱。

SetFontSize(string)

Short overload of SetFontSize that accepts westernSize; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernSize;其餘可選參數使用預設值並轉呼叫最長 SetFontSize 多載。

public void SetFontSize(string westernSize)

Parameters

westernSize string

SetFontSize(string, string?)

Short overload of SetFontSize that accepts westernSize and asianSize; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernSize 與 asianSize;其餘可選參數使用預設值並轉呼叫最長 SetFontSize 多載。

public void SetFontSize(string westernSize, string? asianSize)

Parameters

westernSize string
asianSize string

SetFontSize(string, string?, string?)

Sets the text run's font sizes. 設定文字片段的字型大小。

public void SetFontSize(string westernSize, string? asianSize, string? complexSize)

Parameters

westernSize string

The Western font size. / 西文字型大小。

asianSize string

The East Asian font size. / 東亞字型大小。

complexSize string

The complex script font size. / 複雜文字字型大小。

WithBackgroundColor(string)

Sets this text run's background color. 設定此文字片段的背景色。

public OdfTextRun WithBackgroundColor(string hexColor)

Parameters

hexColor string

The hexadecimal color string, e.g. #FFFF00. / 十六進位顏色字串,例如 #FFFF00

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithBold()

Short overload of WithBold that uses default values for all optional parameters and forwards to the full overload. 便利多載:WithBold 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfTextRun WithBold()

Returns

OdfTextRun

WithBold(bool)

Sets whether this text run is bold. 設定此文字片段是否為粗體。

public OdfTextRun WithBold(bool bold)

Parameters

bold bool

Whether it is bold. / 是否粗體。

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithColor(string)

Sets this text run's font color. 設定此文字片段的字色。

public OdfTextRun WithColor(string hexColor)

Parameters

hexColor string

The hexadecimal color string, e.g. #FF0000. / 十六進位顏色字串,例如 #FF0000

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithFontName(string)

Short overload of WithFontName that accepts westernFont; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernFont;其餘可選參數使用預設值並轉呼叫最長 WithFontName 多載。

public OdfTextRun WithFontName(string westernFont)

Parameters

westernFont string

Returns

OdfTextRun

WithFontName(string, string?)

Short overload of WithFontName that accepts westernFont and asianFont; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernFont 與 asianFont;其餘可選參數使用預設值並轉呼叫最長 WithFontName 多載。

public OdfTextRun WithFontName(string westernFont, string? asianFont)

Parameters

westernFont string
asianFont string

Returns

OdfTextRun

WithFontName(string, string?, string?)

Sets this text run's font names. 設定此文字片段的字型名稱。

public OdfTextRun WithFontName(string westernFont, string? asianFont, string? complexFont)

Parameters

westernFont string

The Western font name. / 西文字型名稱。

asianFont string

The East Asian (CJK) font name; defaults to westernFont if not specified. / 東亞(中日韓)字型名稱;未指定時沿用 westernFont

complexFont string

The complex script font name; defaults to westernFont if not specified. / 複雜文字字型名稱;未指定時沿用 westernFont

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithFontSize(string)

Sets this text run's Western, East Asian, and complex script font sizes. 設定此文字片段的西文、東亞及複雜字型大小。

public OdfTextRun WithFontSize(string size)

Parameters

size string

The font size, e.g. 12pt. / 字型大小,例如 12pt

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithFontVariant(string)

Sets this text run's font variant. 設定此文字片段的字型變體。

public OdfTextRun WithFontVariant(string variant)

Parameters

variant string

The font variant value, e.g. small-caps. / 字型變體值,例如 small-caps

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithItalic()

Short overload of WithItalic that uses default values for all optional parameters and forwards to the full overload. 便利多載:WithItalic 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfTextRun WithItalic()

Returns

OdfTextRun

WithItalic(bool)

Sets whether this text run is italic. 設定此文字片段是否為斜體。

public OdfTextRun WithItalic(bool italic)

Parameters

italic bool

Whether it is italic. / 是否斜體。

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithStrikethrough()

Short overload of WithStrikethrough that uses default values for all optional parameters and forwards to the full overload. 便利多載:WithStrikethrough 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfTextRun WithStrikethrough()

Returns

OdfTextRun

WithStrikethrough(bool)

Sets whether this text run has strikethrough. 設定此文字片段是否加上刪除線。

public OdfTextRun WithStrikethrough(bool strikethrough)

Parameters

strikethrough bool

Whether it has strikethrough. / 是否加上刪除線。

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithSubscript()

Short overload of WithSubscript that uses default values for all optional parameters and forwards to the full overload. 便利多載:WithSubscript 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfTextRun WithSubscript()

Returns

OdfTextRun

WithSubscript(bool)

Sets whether this text run is subscript. 設定此文字片段是否為下標。

public OdfTextRun WithSubscript(bool subscript)

Parameters

subscript bool

Whether it is subscript. / 是否為下標。

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithSuperscript()

Short overload of WithSuperscript that uses default values for all optional parameters and forwards to the full overload. 便利多載:WithSuperscript 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfTextRun WithSuperscript()

Returns

OdfTextRun

WithSuperscript(bool)

Sets whether this text run is superscript. 設定此文字片段是否為上標。

public OdfTextRun WithSuperscript(bool superscript)

Parameters

superscript bool

Whether it is superscript. / 是否為上標。

Returns

OdfTextRun

This text run instance. / 文字片段本身。

WithTextTransform(string)

Sets this text run's case transform. 設定此文字片段的大小寫轉換。

public OdfTextRun WithTextTransform(string transform)

Parameters

transform string

The case transform value, e.g. uppercase. / 大小寫轉換值,例如 uppercase

Returns

OdfTextRun

This text run instance. / 文字片段本身。