Reader Level:
Articles

Windows Forms 2.0 ActiveDocumentHost Control

By Mahesh Chand on Nov 10, 2005
The ActiveDocumentHost control provides the ability to host OLE Documents within your application. This enables you to create applications that allow in-place editing of documents such as Microsoft Word and Excel.
  • 0
  • 0
  • 19442
Download Files:
 

The ActiveDocumentHost control provides the ability to host OLE Documents within your application. This enables you to create applications that allow in-place editing of documents such as Microsoft Word and Excel.

To add an ActiveDocumentHost control to your form, just drag the ActiveHostDocument control from Toolbox to the Form and it will launch Insert Object dialog, where you can specify which OLE Document you want to use. See Figure 1.

ActiveDocumentHost1.jpg

Figure 1. Insert Object dialog.

For instance I select Microsoft Office Excel Worksheet. See Figure 2.

ActiveDocumentHost2.jpg

Figure 2. Selecting Microsoft Office Excel Worksheet

Now I resize the form and control and run the application. When I click on the control, it launches Excel spreadsheet where I can type whatever I want. All menu options of Excel are also available so you can save the contents as well.

ActiveDocumentHost3.jpg

Figure 3. ActiveDocumentHost in action.

I think this is a pretty useful control to have.

Mahesh Chand

Founder C# Corner, a member-contributions based community founded in 1999 focuses on character, values, learning, sharing, networking and career growth. Mahesh has been awarded prestigious... Read more

COMMENT USING