PackagePart Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the PackagePart class.
Overloads
PackagePart(Package, Uri) |
Initializes a new instance of the PackagePart class with a specified parent Package and part URI. |
PackagePart(Package, Uri, String) |
Initializes a new instance of the PackagePart class with a specified parent Package, part URI, and MIME content type. |
PackagePart(Package, Uri, String, CompressionOption) |
Initializes a new instance of the PackagePart class with a specified parent Package, part URI, MIME content type, and CompressionOption. |
Remarks
Open Packaging Conventions Specification
PackagePart(Package, Uri)
- Source:
- PackagePart.cs
- Source:
- PackagePart.cs
- Source:
- PackagePart.cs
Initializes a new instance of the PackagePart class with a specified parent Package and part URI.
protected:
PackagePart(System::IO::Packaging::Package ^ package, Uri ^ partUri);
protected PackagePart (System.IO.Packaging.Package package, Uri partUri);
new System.IO.Packaging.PackagePart : System.IO.Packaging.Package * Uri -> System.IO.Packaging.PackagePart
Protected Sub New (package As Package, partUri As Uri)
Parameters
Exceptions
package
or partUri
is null
.
Remarks
partUri
must be valid PackagePart URI formed in accordance with the RFC 3986 Uniform Resource Identifier (URI) Generic Syntax specification and the Open Packaging Conventions specification.
Use this constructor when the ContentType of the part is not immediately known and will be set later when CreatePart is called.
By default, the CompressionOption property of the part is initialized to NotCompressed.
See also
Applies to
PackagePart(Package, Uri, String)
- Source:
- PackagePart.cs
- Source:
- PackagePart.cs
- Source:
- PackagePart.cs
Initializes a new instance of the PackagePart class with a specified parent Package, part URI, and MIME content type.
protected:
PackagePart(System::IO::Packaging::Package ^ package, Uri ^ partUri, System::String ^ contentType);
protected PackagePart (System.IO.Packaging.Package package, Uri partUri, string? contentType);
protected PackagePart (System.IO.Packaging.Package package, Uri partUri, string contentType);
new System.IO.Packaging.PackagePart : System.IO.Packaging.Package * Uri * string -> System.IO.Packaging.PackagePart
Protected Sub New (package As Package, partUri As Uri, contentType As String)
Parameters
- contentType
- String
The MIME content type of the part data stream.
Exceptions
package
or partUri
is null
.
partUri
is not a valid PackagePart URI.
Remarks
partUri
must be valid PackagePart URI formed in accordance with the RFC 3986 Uniform Resource Identifier (URI) Generic Syntax specification and the Open Packaging Conventions specification.
By default, the CompressionOption property of the part is initialized to NotCompressed.
contentType
must be a MIME type formed in accordance with the RFC 2616 Hypertext Transfer Protocol - HTTP, Section 3.7. The following table shows an example of the content MIME types used in XML Paper Specification (XPS) documents.
Description | Content Type |
---|---|
Font | application/vnd.ms-opentype |
ICC profile | application/vnd.ms-color.iccprofile |
JPEG image | image/jpeg |
Obfuscated font | application/vnd.ms-package.obfuscated-opentype |
PNG image | image/png |
PrintTicket | application/vnd.ms-printing.printticket+xml |
TIFF image | image/tiff |
Windows Media Photo image | image/vnd.ms-photo |
See also
Applies to
PackagePart(Package, Uri, String, CompressionOption)
- Source:
- PackagePart.cs
- Source:
- PackagePart.cs
- Source:
- PackagePart.cs
Initializes a new instance of the PackagePart class with a specified parent Package, part URI, MIME content type, and CompressionOption.
protected:
PackagePart(System::IO::Packaging::Package ^ package, Uri ^ partUri, System::String ^ contentType, System::IO::Packaging::CompressionOption compressionOption);
protected PackagePart (System.IO.Packaging.Package package, Uri partUri, string? contentType, System.IO.Packaging.CompressionOption compressionOption);
protected PackagePart (System.IO.Packaging.Package package, Uri partUri, string contentType, System.IO.Packaging.CompressionOption compressionOption);
new System.IO.Packaging.PackagePart : System.IO.Packaging.Package * Uri * string * System.IO.Packaging.CompressionOption -> System.IO.Packaging.PackagePart
Protected Sub New (package As Package, partUri As Uri, contentType As String, compressionOption As CompressionOption)
Parameters
- contentType
- String
The MIME content type of the part's data stream.
- compressionOption
- CompressionOption
The compression option of the part data stream.
Exceptions
package
or partUri
is null
.
partUri
is not a valid PackagePart URI.
The compressionOption
value is not valid.
Remarks
partUri
must be valid PackagePart URI formed in accordance with the RFC 3986 Uniform Resource Identifier (URI) Generic Syntax specification and the Open Packaging Conventions specification.
contentType
must be a MIME type formed in accordance with the RFC 2616 Hypertext Transfer Protocol - HTTP, Section 3.7. The following table shows an example of the content MIME types used in XML Paper Specification (XPS) documents.
Description | Content Type |
---|---|
Font | application/vnd.ms-opentype |
ICC profile | application/vnd.ms-color.iccprofile |
JPEG image | image/jpeg |
Obfuscated font | application/vnd.ms-package.obfuscated-opentype |
PNG image | image/png |
PrintTicket | application/vnd.ms-printing.printticket+xml |
TIFF image | image/tiff |
Windows Media Photo image | image/vnd.ms-photo |