OpenXmlPartContainer.AddExternalRelationship Method (String, Uri, String)
Adds external relationship. Do not add hyperlink relationships through this method. Use AddHyperlinkRelationship() instead.
Namespace: DocumentFormat.OpenXml.Packaging
Assembly: DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)
Syntax
'宣言
Public Function AddExternalRelationship ( _
relationshipType As String, _
externalUri As Uri, _
id As String _
) As ExternalRelationship
'使用
Dim instance As OpenXmlPartContainer
Dim relationshipType As String
Dim externalUri As Uri
Dim id As String
Dim returnValue As ExternalRelationship
returnValue = instance.AddExternalRelationship(relationshipType, _
externalUri, id)
public ExternalRelationship AddExternalRelationship(
string relationshipType,
Uri externalUri,
string id
)
Parameters
- relationshipType
Type: System.String
The relationship type.
- externalUri
Type: System.Uri
The external URI.
- id
Type: System.String
The desired relationship ID.
Return Value
Type: DocumentFormat.OpenXml.Packaging.ExternalRelationship
An ExternalRelationship with the relationship ID.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | Thrown when "relationshipType" or the "externalUri" is null reference. |
InvalidOperationException | Thrown when the relatioship type is hyperlink relationship type (https://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink). |