Skip to content
On this page

Microsoft Office Add-ins using NetOffice

You can use the NetOffice library to create .NET Framework applications that extend Office. These applications are also named in old MSDN documentation as Office solutions or COM Add-ins for Microsoft Office.

Getting Started

Download our NetOffice extension from the Visual Studio Marketplace.

In the Create new project dialog search for NetOffice and select a template based on the Microsoft Office application you want to extend.

Create new project - NetOffice add-in templates

Look for the MyAddin class in the project. Use the MyAddin_OnConnection method to add handlers for the events provided by Office application.

csharp
using NetOffice.ExcelApi.Tools;

[ComVisible(true)]
[ProgId("ExcelAddinSample.MyAddin")]
[Guid("CC85F97A-F409-4497-B2F2-A9581D4A2ED2")]
[COMAddin("MyAddin", "Addin description.", LoadBehavior.LoadAtStartup)]
public class MyAddin : COMAddin
{
    private void MyAddin_OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
    {
        this.Application.WorkbookOpenEvent += Application_WorkbookOpenEvent;
    }
}

Advanced Add-ins

You project can have multiple add-ins targeting different Microsoft Office applications.

Each add-in class which extends COMAddin must have its unique [ProgId] and [Guid] values so it can be properly identified in COM infrastructure. Each add-in class must have the [ComVisible(true)] attribute.

Add-in classes must extends from the COMAddin class provided by the NetOffice library.

COMAddin Classes

NetOffice provides COMAddin classes for each Microsoft Office application. You will find the COMAddin class in the Tools namespace in each NetOffice library for an Office application.

Office ApplicationNetOffice packageLinkCOMAddin Class
MS WordNetOfficeFw.WordNetOfficeFw.WordNetOffice.WordApi.Tools.COMAddin
MS ExcelNetOfficeFw.ExcelNetOfficeFw.ExcelNetOffice.ExcelApi.Tools.COMAddin
MS PowerPointNetOfficeFw.PowerPointNetOfficeFw.PowerpointNetOffice.PowerPointApi.Tools.COMAddin
MS OutlookNetOfficeFw.OutlookNetOfficeFw.OutlookNetOffice.OutlookApi.Tools.COMAddin
Microsoft Office Add-ins using NetOffice has loaded