Condividi tramite


How to: Add XMLNode Controls to Word Documents

Important   The information set out in this topic regarding Microsoft Word is presented exclusively for the benefit and use of individuals and organizations who are located outside the United States and its territories or who are using, or developing programs that run on, Microsoft Word products that were licensed by Microsoft before January 2010, when Microsoft removed an implementation of particular functionality related to custom XML from Microsoft Word. This information regarding Microsoft Word may not be read or used by individuals or organizations in the United States or its territories who are using, or developing programs that run on, Microsoft Word products that were licensed by Microsoft after January 10, 2010; those products will not behave the same as products licensed before that date or purchased and licensed for use outside the United States.

Applies to: The information in this topic applies to document-level projects for Word 2013 and Word 2010. For more information, see Features Available by Office Application and Project Type.

When you map a non-repeating XML schema element to a Microsoft Office Word document, Visual Studio automatically adds an XMLNode control to your document. For information about mapping repeating XML schema elements, see How to: Add XMLNodes Controls to Word Documents.

Note

The XMLNode control is not available from the Toolbox or the Data Sources window, and it cannot be created programmatically.

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings in Visual Studio.

To add an XMLNode control to a document

  1. In the document in the Visual Studio designer, on the Ribbon, click the Developer tab.

    Note

    If the Developer tab is not visible, you must first show it. For more information, see How to: Show the Developer Tab on the Ribbon.

  2. In the XML group, click Schema.

    The Templates and Add-ins dialog box opens.

  3. Click the XML Schema tab.

  4. Click Add Schema.

    The Add Schema dialog box opens.

  5. Select an XML schema that contains non-repeating schema elements from the Add Schema dialog box and click Open.

    The Schema Settings dialog box appears.

  6. Assign an alias or click OK to add the schema without an alias.

    The schema is added to the Add Schema dialog box.

  7. In the Add Schema dialog box, click OK.

  8. The XML Structure task pane opens.

  9. Click the non-repeating schema element on the XML Structure task pane to add it to the document.

    An XMLNode control is created and added to the project.

See Also

Concepts

XMLNode Control

Automating Word by Using Extended Objects

Host Items and Host Controls Overview

Programmatic Limitations of Host Items and Host Controls