Table of Contents

Class OdfDocumentKindDetector

Namespace
OdfKit.Compliance
Assembly
OdfKit.dll

Provides the OdfDocumentKindDetector API. 從 MIME 類型與副檔名偵測 ODF 文件種類。

public static class OdfDocumentKindDetector
Inheritance
OdfDocumentKindDetector
Inherited Members

Properties

SupportedFormats

Provides the SupportedFormats member. 取得目前支援偵測的 ODF 格式描述清單。

public static IReadOnlyList<OdfFormatInfo> SupportedFormats { get; }

Property Value

IReadOnlyList<OdfFormatInfo>

Methods

FromFileName(string?)

Creates from file name. 從檔案名稱或副檔名偵測 ODF 文件種類。

public static OdfDocumentKind FromFileName(string? fileName)

Parameters

fileName string

檔案名稱或副檔名

Returns

OdfDocumentKind

偵測到的 ODF 文件種類;若無法識別則傳回 Unknown

FromMimeType(string?)

Creates from mime type. 從 ODF MIME 類型偵測封裝的 ODF 文件種類。

public static OdfDocumentKind FromMimeType(string? mimeType)

Parameters

mimeType string

MIME 類型

Returns

OdfDocumentKind

偵測到的 ODF 文件種類;若無法識別則傳回 Unknown

FromOfficeBodyElement(string?, bool)

Creates from office body element. 從 office:body 下的第一個 ODF 子元素偵測內容種類。

public static OdfDocumentKind FromOfficeBodyElement(string? localName, bool flat)

Parameters

localName string

元素區域名稱

flat bool

是否為單一 XML (Flat XML) 文件

Returns

OdfDocumentKind

偵測到的 ODF 文件種類

IsCompatibleWithBodyKind(OdfDocumentKind, OdfDocumentKind)

Returns whether this instance is compatible with body kind. 傳回宣告的文件種類是否與偵測到的 office:body 種類相容。

public static bool IsCompatibleWithBodyKind(OdfDocumentKind declaredKind, OdfDocumentKind bodyKind)

Parameters

declaredKind OdfDocumentKind

宣告的文件種類

bodyKind OdfDocumentKind

主體元素種類

Returns

bool

若相容或任一種類為未知則傳回 true;否則傳回 false

IsFlatKind(OdfDocumentKind)

Returns whether this instance is flat kind. 傳回指定的種類是否代表單一 XML (Flat XML) ODF 文件。

public static bool IsFlatKind(OdfDocumentKind kind)

Parameters

kind OdfDocumentKind

ODF 文件種類

Returns

bool

若是單一 XML ODF 文件種類則傳回 true;否則傳回 false

IsMasterKind(OdfDocumentKind)

Returns whether this instance is master kind. 傳回指定的種類是否代表 ODF 主控文件。

public static bool IsMasterKind(OdfDocumentKind kind)

Parameters

kind OdfDocumentKind

ODF 文件種類

Returns

bool

若是 ODF 主控文件種類則傳回 true;否則傳回 false

IsTemplateKind(OdfDocumentKind)

Returns whether this instance is template kind. 傳回指定的種類是否代表 ODF 範本文件。

public static bool IsTemplateKind(OdfDocumentKind kind)

Parameters

kind OdfDocumentKind

ODF 文件種類

Returns

bool

若是 ODF 範本文件種類則傳回 true;否則傳回 false

ToContentKind(OdfDocumentKind)

Converts to content kind. 將範本、主控文件及單一 XML 變體轉換為在 office:body 下表示的內容種類。

public static OdfDocumentKind ToContentKind(OdfDocumentKind kind)

Parameters

kind OdfDocumentKind

ODF 文件種類

Returns

OdfDocumentKind

對應的內容種類;若無對應種類則傳回原種類

ToFlatKind(OdfDocumentKind)

Converts to flat kind. 將封裝的 ODF 種類轉換為其對應的單一 XML (Flat XML) 種類。

public static OdfDocumentKind ToFlatKind(OdfDocumentKind kind)

Parameters

kind OdfDocumentKind

ODF 文件種類

Returns

OdfDocumentKind

轉換後的單一 XML 種類;若無對應種類則傳回原種類

TryGetFormatByFileName(string?, out OdfFormatInfo?)

Tries to get format by file name. 從檔案名稱或副檔名取得格式描述。

public static bool TryGetFormatByFileName(string? fileName, out OdfFormatInfo? format)

Parameters

fileName string

檔案名稱或副檔名

format OdfFormatInfo

成功時傳回格式描述

Returns

bool

若副檔名已知則傳回 true;否則傳回 false

TryGetFormatByKind(OdfDocumentKind, out OdfFormatInfo?)

Tries to get format by kind. 從 ODF 文件種類取得格式描述。

public static bool TryGetFormatByKind(OdfDocumentKind kind, out OdfFormatInfo? format)

Parameters

kind OdfDocumentKind

ODF 文件種類

format OdfFormatInfo

成功時傳回格式描述

Returns

bool

若文件種類已知則傳回 true;否則傳回 false

TryGetFormatByMimeType(string?, out OdfFormatInfo?)

Tries to get format by mime type. 從 ODF MIME 類型取得格式描述。

public static bool TryGetFormatByMimeType(string? mimeType, out OdfFormatInfo? format)

Parameters

mimeType string

MIME 類型

format OdfFormatInfo

成功時傳回格式描述

Returns

bool

若 MIME 類型已知則傳回 true;否則傳回 false