Share via


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 处于打开状态时才能访问该属性。

属性 ContentTypePackagePart 构造函数自动设置。 构造函数设置后, ContentType 无法更改 。

属性 ContentType 是按照 RFC 2616超文本传输协议 - HTTP 第 3.7 节形成的 MIME 类型。 下表显示了 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

适用于

另请参阅