Поделиться через


DataSourceReference Class

Data Source File Path.When the object is serialized out as xml, its qualified name is w:dataSource.

Inheritance Hierarchy

System.Object
  DocumentFormat.OpenXml.OpenXmlElement
    DocumentFormat.OpenXml.OpenXmlLeafElement
      DocumentFormat.OpenXml.Wordprocessing.RelationshipType
        DocumentFormat.OpenXml.Wordprocessing.DataSourceReference

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

Syntax

'Declaration
Public Class DataSourceReference _
    Inherits RelationshipType
'Usage
Dim instance As DataSourceReference
public class DataSourceReference : RelationshipType

Remarks

[ISO/IEC 29500-1 1st Edition]

17.14.9 dataSource (Data Source File Path)

This element specifies the relationship whose target is the location of the external data source to be connected to a given WordprocessingML document to perform the mail merge (for a source document) or to find the associated field data (for a merged document).

If this element is omitted, then no file location is specified for the data source for the current mail merge. If no relationship exists with the given relationship ID, or this relationship is not of type http://schemas.openxmlformat.org/officeDocument/2006/relationships/mailMergeSource then this document shall be considered non-conformant.

The data source location can also be ignored under the following conditions:

  • The src element (§17.14.30) is present within the mail merge data

  • The dataType element (§17.14.10) is set to native

  • The current application is able to use the information contained in the odso element (§17.14.25) to access the data source

[Guidance: In this case, using the data source file path in the src element provides an equal or greater amount of information for the mail merge data source for clients which can consume it. end guidance]

[Example: Consider a WordprocessingML source document containing the following mail merge data:

<w:mailMerge>
…
<w:dataSource r:id="rId1" />
…
</w:mailMerge>

This mail merge's dataSource element specifies via its r:id attribute value of rId1 that the external data source to be connected to the given WordprocessingML document is the data source targeted by the relationship whose Id attribute is equal to rId1. If we examine the corresponding relationship part item for the setting part, as follows:

<Relationships>
<Relationship Id="rId1" Type="https://schemas.openxmlformats.org/officeDocument/2006/relationships/mailMergeSource" Target="file:///c:/example_file.mdb" TargetMode="External" />
</Relationships>

Since the relationship whose Id attribute value is rId1 specifies the source file path for the data source, that data source effectively specifies a file path of c:\example_file.mdb. end example]

Parent Elements

mailMerge (§17.14.20)

Attributes

Description

id (Relationship to Part)

Namespace: .../officeDocument/2006/relationships

Specifies the relationship ID to a specified part.

The specified relationship shall match the relationship type required by the parent element:

  • https://schemas.openxmlformats.org/officeDocument/2006/customXml for the contentPart element

  • https://schemas.openxmlformats.org/officeDocument/2006/relationships/footer for the footerReference element

  • https://schemas.openxmlformats.org/officeDocument/2006/relationships/header for the headerReference element

  • https://schemas.openxmlformats.org/officeDocument/2006/relationships/font for the embedBold, embedBoldItalic, embedItalic, or embedRegular elements

  • https://schemas.openxmlformats.org/officeDocument/2006/relationships/printerSettings for the printerSettings element

  • https://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink for the longDesc or hyperlink element

[Example: Consider an XML element which has the following id attribute:

<… r:id="rId10" />

The markup specifies the associated relationship part with relationship ID rId1 contains the corresponding relationship information for the parent XML element. end example]

The possible values for this attribute are defined by the ST_RelationshipId simple type (§22.8.2.1).

[Note: The W3C XML Schema definition of this element’s content model (CT_Rel) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

DataSourceReference Members

DocumentFormat.OpenXml.Wordprocessing Namespace