Automation API
Automation API enables interaction with office documents from external sources through custom interface elements. Build your own UI components while leveraging ONLYOFFICE document processing — manage comments, control review workflows, auto-fill forms, and more, all from outside the editor.
Automation API is available only for ONLYOFFICE Docs Developer.
This is a premium feature not included by default and is available at an extra cost. Please contact our sales team at sales@onlyoffice.com to request a quote, or learn more at onlyoffice.com/automation-api.
What you can build
Explore interactive examples showing real-world use cases:
| Use case | Description |
|---|---|
| Working with comments | Collect and display all document comments in a custom interface. Add, remove, and navigate between comments from your own UI. |
| Managing review changes | Control the review process externally — accept or reject tracked changes and navigate between revisions from a custom panel. |
| Filling out forms | Auto-populate form fields with external data. Sync form values between your interface and the document in real-time. |
| Working with content controls | Add different types of content controls and inspect their properties from an external UI. |
Getting started
To start using Automation API, create a connector using the createConnector method:
const connector = docEditor.createConnector();
The connector provides methods to execute editor commands, listen to document events, and interact with the editor UI:
// Listen to document events
connector.attachEvent("onChangeContentControl", (obj) => {
console.log("Content changed:", obj);
});
// Execute editor methods
connector.executeMethod("GetAllComments", null, (comments) => {
console.log("Comments:", comments);
});
// Insert content into the document
connector.callCommand(() => {
const oDocument = Api.GetDocument();
const oParagraph = Api.CreateParagraph();
oParagraph.AddText("Hello from Automation API");
oDocument.InsertContent([oParagraph]);
});
API reference
- Connector class — methods for interacting with the editor
- Connector window — methods for creating and managing modal windows