Creates a package-level relationship to a given part.
Assembly: WindowsBase (in WindowsBase.dll)
|CreateRelationship(Uri, TargetMode, String)|
Creates a package-level relationship to a part with a given URI, target mode, and relationship type.
|CreateRelationship(Uri, TargetMode, String, String)|
Creates a package-level relationship to a part with a given URI, target mode, relationship type, and identifier (ID).
A package-level relationship defines an association between the package and an associated target part or resource. A package-level relationship can be one of two forms.
Between a Package to a target resource outside the package.
In a package-relationship the package is considered the "owner" of the relationship. When the package is deleted, all the relationships owned by the package are also deleted. The process of creating or deleting the relationship does not physically alter the target part or resource in any way.
For additional information, see the Open Packaging Conventions (OPC) specification available for download at http://go.microsoft.com/fwlink/?LinkID=71255.
' Add the Document part to the Package Dim packagePartDocument As PackagePart = package.CreatePart(partUriDocument, System.Net.Mime.MediaTypeNames.Text.Xml) ' Copy the data to the Document Part Using fileStream As New FileStream(documentPath, FileMode.Open, FileAccess.Read) CopyStream(fileStream, packagePartDocument.GetStream()) End Using ' end:using(fileStream) - Close and dispose fileStream. ' Add a Package Relationship to the Document Part package.CreateRelationship(packagePartDocument.Uri, TargetMode.Internal, PackageRelationshipType)