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
Methods
FromFileName(string?)
Creates from file name. 從檔案名稱或副檔名偵測 ODF 文件種類。
public static OdfDocumentKind FromFileName(string? fileName)
Parameters
fileNamestring檔案名稱或副檔名
Returns
- OdfDocumentKind
偵測到的 ODF 文件種類;若無法識別則傳回 Unknown
FromMimeType(string?)
Creates from mime type. 從 ODF MIME 類型偵測封裝的 ODF 文件種類。
public static OdfDocumentKind FromMimeType(string? mimeType)
Parameters
mimeTypestringMIME 類型
Returns
- OdfDocumentKind
偵測到的 ODF 文件種類;若無法識別則傳回 Unknown
FromOfficeBodyElement(string?, bool)
Creates from office body element.
從 office:body 下的第一個 ODF 子元素偵測內容種類。
public static OdfDocumentKind FromOfficeBodyElement(string? localName, bool flat)
Parameters
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
declaredKindOdfDocumentKind宣告的文件種類
bodyKindOdfDocumentKind主體元素種類
Returns
IsFlatKind(OdfDocumentKind)
Returns whether this instance is flat kind. 傳回指定的種類是否代表單一 XML (Flat XML) ODF 文件。
public static bool IsFlatKind(OdfDocumentKind kind)
Parameters
kindOdfDocumentKindODF 文件種類
Returns
IsMasterKind(OdfDocumentKind)
Returns whether this instance is master kind. 傳回指定的種類是否代表 ODF 主控文件。
public static bool IsMasterKind(OdfDocumentKind kind)
Parameters
kindOdfDocumentKindODF 文件種類
Returns
IsTemplateKind(OdfDocumentKind)
Returns whether this instance is template kind. 傳回指定的種類是否代表 ODF 範本文件。
public static bool IsTemplateKind(OdfDocumentKind kind)
Parameters
kindOdfDocumentKindODF 文件種類
Returns
ToContentKind(OdfDocumentKind)
Converts to content kind.
將範本、主控文件及單一 XML 變體轉換為在 office:body 下表示的內容種類。
public static OdfDocumentKind ToContentKind(OdfDocumentKind kind)
Parameters
kindOdfDocumentKindODF 文件種類
Returns
- OdfDocumentKind
對應的內容種類;若無對應種類則傳回原種類
ToFlatKind(OdfDocumentKind)
Converts to flat kind. 將封裝的 ODF 種類轉換為其對應的單一 XML (Flat XML) 種類。
public static OdfDocumentKind ToFlatKind(OdfDocumentKind kind)
Parameters
kindOdfDocumentKindODF 文件種類
Returns
- OdfDocumentKind
轉換後的單一 XML 種類;若無對應種類則傳回原種類
TryGetFormatByFileName(string?, out OdfFormatInfo?)
Tries to get format by file name. 從檔案名稱或副檔名取得格式描述。
public static bool TryGetFormatByFileName(string? fileName, out OdfFormatInfo? format)
Parameters
fileNamestring檔案名稱或副檔名
formatOdfFormatInfo成功時傳回格式描述
Returns
TryGetFormatByKind(OdfDocumentKind, out OdfFormatInfo?)
Tries to get format by kind. 從 ODF 文件種類取得格式描述。
public static bool TryGetFormatByKind(OdfDocumentKind kind, out OdfFormatInfo? format)
Parameters
kindOdfDocumentKindODF 文件種類
formatOdfFormatInfo成功時傳回格式描述
Returns
TryGetFormatByMimeType(string?, out OdfFormatInfo?)
Tries to get format by mime type. 從 ODF MIME 類型取得格式描述。
public static bool TryGetFormatByMimeType(string? mimeType, out OdfFormatInfo? format)
Parameters
mimeTypestringMIME 類型
formatOdfFormatInfo成功時傳回格式描述