Table of Contents

Class OdfNumberFormatEngine

Namespace
OdfKit.Styles
Assembly
OdfKit.dll

Provides the OdfNumberFormatEngine API. ODF 數字格式引擎,依 number:*-style 格式定義節點格式化數值。

public static class OdfNumberFormatEngine
Inheritance
OdfNumberFormatEngine
Inherited Members

Methods

FindFormatNode(OdfNode, string)

Finds format node. 在 stylesDom 中查找指定名稱的 number:*-style 節點。

public static OdfNode? FindFormatNode(OdfNode stylesDom, string styleName)

Parameters

stylesDom OdfNode
styleName string

Returns

OdfNode

Format(DateTime, OdfNode)

Performs the Format operation. 依 ODF 日期/時間格式定義節點格式化日期時間值。

public static string Format(DateTime value, OdfNode dateStyleNode)

Parameters

value DateTime

要格式化的日期時間值

dateStyleNode OdfNode

格式定義根節點(例如 number:date-style

Returns

string

格式化後的字串

Format(double, OdfNode)

Performs the Format operation. 依 ODF 數字/貨幣/百分比格式定義節點格式化浮點數值。

public static string Format(double value, OdfNode numberStyleNode)

Parameters

value double

要格式化的數值

numberStyleNode OdfNode

格式定義根節點(例如 number:number-style

Returns

string

格式化後的字串

Format(object?, string, OdfNode)

Performs the Format operation. 依樣式名稱從文件樣式 DOM 查找對應格式節點並格式化。

public static string Format(object? value, string styleName, OdfNode stylesDom)

Parameters

value object

要格式化的值(double、DateTime、bool、string)

styleName string

ODF 數字樣式名稱(style:data-style-name 的值)

stylesDom OdfNode

styles.xml 或 content.xml 的 DOM 根節點

Returns

string

格式化後的字串;若找不到對應樣式則回傳原始值的字串表示