Windows Forms 2.0 ActiveDocumentHost Control


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.

Up Next
    Ebook Download
    View all
    Learn
    View all