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
  • 19783
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

C# Corner founder, 10-times Microsoft MVP, technical author, and software architect. Mahesh authored his first book, A Programmer’s Guide to ADO.NET in C# with APress at the age of 25. C# Corner is a memb... Read more

COMMENT USING