Dela via


How to: Add XMLNodes 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 only to the specified Visual Studio Tools for Office projects and versions of Microsoft Office.

Project type

  • Document-level projects

Microsoft Office version

  • Word 2007

  • Word 2003

For more information, see Features Available by Application and Project Type.

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

The procedures are different for Word 2007 and Word 2003.

Note

The XMLNodes control is not available from the Toolbox or the Data Sources window, nor can it 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 Visual Studio Settings.

To add an XMLNodes control to a document in Word 2007

  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 repeating schema elements 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.

    The XML Structure task pane opens.

  8. Click the repeating schema element on the XML Structure task pane to add it to the document.

    An XMLNodes control is created and added to the project.

To add an XMLNodes control to a document in Word 2003

  1. In Visual Studio, on the Tools menu, point to Microsoft Office Word Tools, and then click Templates and Add-Ins.

    The Templates and Add-ins dialog box appears.

    Note

    If Microsoft Office Word Tools is not available on the Tools menu, click the document to give it focus.

  2. On the XML Schema tab, click Add Schema.

    The Add Schema dialog box appears.

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

    The Schema Settings dialog box appears.

  4. In the Schema Settings dialog box, click OK.

    The schema is added to the Add Schema dialog box.

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

    The XML Structure task pane opens.

  6. Click the repeating schema element on the XML Structure task pane to add it to the document.

    An XMLNodes control is created and added to the project.

See Also

Concepts

XMLNodes Control

Host Items and Host Controls Overview

Programmatic Limitations of Host Items and Host Controls

Other Resources

Word Host Controls

Excel Host Controls