Class OdfMediaManager
Provides the OdfMediaManager API. 管理 ODF 封裝中的媒體專案(如圖片),提供重複資料刪除與格式偵測功能。
public class OdfMediaManager
- Inheritance
-
OdfMediaManager
- Inherited Members
Constructors
OdfMediaManager(OdfPackage)
Performs odf media manager. 初始化 OdfMediaManager 類別的新執行個體。
public OdfMediaManager(OdfPackage package)
Parameters
packageOdfPackageODF 封裝執行個體
Fields
PicturesEntryPrefix
The canonical package entry path prefix used for embedded media (e.g. images). 內嵌媒體(如圖片)於封裝中使用的規範項目路徑前綴。
public const string PicturesEntryPrefix = "Pictures/"
Field Value
Methods
AddImage(byte[])
Short overload of AddImage that accepts imageBytes; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 imageBytes;其餘可選參數使用預設值並轉呼叫最長 AddImage 多載。
public string AddImage(byte[] imageBytes)
Parameters
imageBytesbyte[]
Returns
AddImage(byte[], string?)
Adds image. 插入圖片二進位資料。若圖片內容已存在,則會自動重用現有路徑,實現自動重複資料刪除。
public string AddImage(byte[] imageBytes, string? preferredName)
Parameters
Returns
- string
傳回該圖片在 ODF 封裝中的相對路徑(例如 "Pictures/image_hash.png" )
DetectImageFormat(byte[], out string, out string)
Detects image format. 根據檔案的幻數(Magic Bytes)偵測圖片格式。
public static void DetectImageFormat(byte[] bytes, out string mimeType, out string extension)