PackagePart.ContentType 屬性

定義

取得內容數據流的MIME類型。

public:
 property System::String ^ ContentType { System::String ^ get(); };
public string ContentType { get; }
member this.ContentType : string
Public ReadOnly Property ContentType As String

屬性值

元件之內容數據流的MIME類型。

例外狀況

組件已經刪除。

-或-

Package 沒有開啟 (已經呼叫 Dispose(Boolean)Close())。

-或-

衍生類別 GetContentTypeCore() 方法傳回的字串是空的。

備註

ContentType 是唯讀屬性,只能在父 Package 系開啟時存取。

ContentType 構函式會自動設定 PackagePart 屬性。 建構函式設定之後, ContentType 就無法變更 。

屬性 ContentType 是MIME類型,根據 RFC 2616超文本傳輸通訊協定 - HTTP,第3.7節。 下表顯示 XML 檔規格 (XPS) 檔中所使用的內容 MIME 類型範例。

描述 內容類型
字型 application/vnd.ms-opentype
ICC 設定檔 application/vnd.ms-color.iccprofile
JPEG 影像 image/jpeg
模糊字型 application/vnd.ms-package.obfuscated-opentype
PNG 影像 image/png
PrintTicket application/vnd.ms-printing.printticket+xml
TIFF 影像 image/tiff
Windows Media 相片影像 image/vnd.ms-photo

適用於

另請參閱