Using Windows Forms Controls on Word Documents
This documentation is archived and is not being maintained.

Using Windows Forms Controls on Word Documents

Updated: July 2008

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

  • Application-level projects

Microsoft Office version

  • Word 2007

  • Word 2003

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

You can add Windows Forms controls to a Microsoft Office Word document in the same manner that you add controls to Windows Forms. However, there are some differences in the way that Windows Forms controls behave on documents. For general information about working with controls on documents, see Windows Forms Controls on Office Documents Overview.

There are a few considerations that are specific to Word.

Layout Style

When you add a control to the Word document in a document-level project by using the Visual Studio designer, the control is added in line with text. To change the layout style of the control, right-click the control and then click Format Control. Select a wrapping style on the Layout page of the Format Object dialog box.

When you add a control to a Word document at run time, you can specify the layout style of the new control by using different Add<control class> method overloads of the Microsoft.Office.Tools.Word.ControlCollection class:

  • To add the control in line with text, use an overload that accepts a Range that specifies the location of the control.

  • To add the control as a floating shape, use an overload that accepts the left and top coordinates of the control.

For more information, see Adding Controls to Office Documents at Run Time and Helper Methods for Windows Forms Controls.

If you open a Word template in the Visual Studio designer, non-inline controls on the template might not be visible because Visual Studio opens the template in Normal view. To view the controls, change the view to Print Layout.


To add controls to documents at run time by using an application-level add-in, you must install Visual Studio 2008 Service Pack 1 (SP1).

Controls Outside the Main Document Body

Windows Forms controls are not supported inside of a header or footer, or within a subdocument.




July 2008

Added information about specifying the layout style of controls at run time.

SP1 feature change.

© 2016 Microsoft