Compartilhar via


How to: Add XMLNode controls to Word documents

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

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. 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 Personalize the IDE.

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