OpenXmlPartContainer.CreateRelationshipToPart Method (OpenXmlPart, String)
Adds relationship for the specified part to this part.
Namespace: DocumentFormat.OpenXml.Packaging
Assembly: DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)
Syntax
'宣言
Public Function CreateRelationshipToPart ( _
targetPart As OpenXmlPart, _
id As String _
) As String
'使用
Dim instance As OpenXmlPartContainer
Dim targetPart As OpenXmlPart
Dim id As String
Dim returnValue As String
returnValue = instance.CreateRelationshipToPart(targetPart, _
id)
public string CreateRelationshipToPart(
OpenXmlPart targetPart,
string id
)
Parameters
- targetPart
Type: DocumentFormat.OpenXml.Packaging.OpenXmlPart
The part to add relationship for.
- id
Type: System.String
A unique relationship identifier.
Return Value
Type: System.String
A unique relationship identifier.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | Thrown when "part" or the "id" is null reference. |
ArgumentOutOfRangeException | Thrown when the part is no allowed to be added. |
OpenXmlPackageException | Thrown when one instance of same type part already exists and multiple instance of that type is not allowed. |
InvalidOperationException | Thrown when the targetPart and this part are not in the same OpenXmlPackage. |