Microsoft Office Compatible 97 API

June 1996

Abstract

This article describes the contents of the Office Compatible API set and how to effectively use them in your Office Compatible solution. The API set provides interfaces for both C/C++ and Visual Basic applications as well as sample code for both approaches. The reader is assumed to have a working knowledge of C Windows or Visual Basic programming.

Click to open or copy the Office Compatible API set sample files for this technical article.

Introduction

The Microsoft Office Compatible API set offers users access to features previously available only to Microsoft Office suite applications. This feature set targets the needs of vertical application developers who want to use the powerful yet easy-to-implement features already familiar to their user base. Because users work with these features everyday in Office applications, other applications that employ these features are instantly familiar and easy to use. The calls of this feature set use the same dialogs generated by Microsoft applications.

Contained in a single DLL (msoc.dll) and installed to a user’s computer during a typical installation of Microsoft Office, the Microsoft Office Compatible API set offers interfaces for both C/C++ and Visual Basic/VBA applications. For Visual Basic solutions, msoc.dll provides an inproc automation server, implementing an IDispatch interface which uses the same model as the Microsoft Office applications. This approach allows Visual Basic applications to use CreateObject to access the DLL, or to refer to the DLL directly, and use the features while the solution limits the inter-process performance hit. These calls are provided external to the Object Model of any individual application. This allows the calls to be executed without loading and executing any of the Microsoft Office applications.

The DLL provides the following feature set:

Standard and Custom Properties. These calls are a natural extension of the Properties API set released in Office Compatible 95. These calls allow the developer to manipulate both the predefined properties of all Office documents as well as the custom document properties employed by the user in the vertical application.

AutoCorrect. The AutoCorrect feature lets the end user set rules for common typing or spelling errors and have those errors updated automatically as they type.

Post to Exchange. This feature allows users to post to Exchange non-Office document types including those from commercial or vertical applications which do not provide  a posting feature themselves. Exchange serves as a central repository for storage or discussion of a document.

Add Routing Slip. This feature allows users to route non-Office document types in e-mail. Routing is useful if, for example, you want a number of co-workers to review a document electronically.

Outlook Journaling. With the Microsoft Outlook Journal feature, a user can record a wide range of events she performs using the applications on her machine. This set of calls enables a program to record to Microsoft Outlook user events on new or existing files.  User events which get recorded include New, Open, Print, Send, Post, Route, Save, and Close.

Typical Scenario using the OC API Feature Set

The following scenario is one of many ways a corporation might make use of the Office Compatible API feature set. While this scenario demonstrates how all the features might be used together, it is not necessary to use them all.

Corporation X uses an application that creates documents such as CAD drawings. The application they use for this purpose does not provide routing.  However, the internal MIS group develops a custom application that will route these documents from Engineering to Drafting to Manufacturing. This custom application also attaches a company-specific change form document to the drawing file. Because the application uses the AutoCorrect feature, an engineer can expect that the same typing errors which get caught and automatically corrected in Word will also be automatically corrected as the team fills out the change form. As each reviewer completes his or her changes and routes the document to the next person on the list, the custom application records the document save event in Outlook Journal.  The change form includes custom properties which track the review status of the several departments and tell the application to automatically update those property values in the document and post the document to Exchange after two of the three groups have finished their review. 

Additional Articles

The additional articles describe each of the features and their API calls in more detail.  In addition, sample code for both the C/C++ and Visual Basic interfaces provides implementation examples for all the above features. 

Note   These API calls are not required as part of the Office Compatible Logo Program. Conversely, developers need not sign up for the Logo Program in order to make use of these calls. No rights are given to redistribute the Office Compatible nor Office DLL. Office must be installed on the user machine in order to access these calls.