Document.CustomXMLParts Property (2007 System)
Returns the custom XML parts in the document.
Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
<BrowsableAttribute(False)> _
Public ReadOnly Property CustomXMLParts As CustomXMLParts
'Usage
Dim instance As Document
Dim value As CustomXMLParts
value = instance.CustomXMLParts
[BrowsableAttribute(false)]
public CustomXMLParts CustomXMLParts { get; }
[BrowsableAttribute(false)]
public:
property CustomXMLParts^ CustomXMLParts {
CustomXMLParts^ get ();
}
public function get CustomXMLParts () : CustomXMLParts
Property Value
Type: CustomXMLParts
A Microsoft.Office.Core.CustomXMLParts collection that contains the custom XML parts in the document.
Remarks
For more information about using custom XML parts in Visual Studio Tools for Office projects, see Custom XML Parts Overview.
Examples
The following code example embeds employee data in the document by adding a Microsoft.Office.Core.CustomXMLPart to the CustomXMLParts collection in the current document.
This example is for a document-level customization.
Private Sub AddCustomXmlPartToDocument()
Dim xmlString As String = _
"<?xml version=""1.0"" encoding=""utf-8"" ?>" & _
"<employees https://schemas.microsoft.com/vsto/samples"">" & _
"<employee>" & _
"<name>Karina Leal</name>" & _
"<hireDate>1999-04-01</hireDate>" & _
"<title>Manager</title>" & _
"</employee>" & _
"</employees>"
Dim employeeXMLPart As Office.CustomXMLPart = _
Me.CustomXMLParts.Add(xmlString)
End Sub
private void AddCustomXmlPartToDocument()
{
string xmlString =
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>" +
"<employees xmlns=\"https://schemas.microsoft.com/vsto/samples\">" +
"<employee>" +
"<name>Karina Leal</name>" +
"<hireDate>1999-04-01</hireDate>" +
"<title>Manager</title>" +
"</employee>" +
"</employees>";
Office.CustomXMLPart employeeXMLPart = this.CustomXMLParts.Add(xmlString, missing);
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Microsoft.Office.Tools.Word Namespace