ONLYOFFICE updates for developers: API & Doc Builder [March 2023]
Tags: onlyoffice, news, api, opensource
Published: 2023-03-22 09:12:49

Explore the updated ONLYOFFICE API for the editors, plugins, and Document Builder.

## Enhanced WOPI support

From now on, you are able to work with the binary formats such as doc, ppt, and xls within WOPI integrations. We implemented the corresponding [scheme](https://api.onlyoffice.com/editors/wopi/editingbinary) which includes the [convert](https://api.onlyoffice.com/editors/wopi/discovery#convert) action in the WOPI discovery. It converts binary files into _docx, pptx,_ and _xlsx_ for further editing.

Besides, we added the [WOPI Conversion API](https://api.onlyoffice.com/editors/wopi/conversionapi) for easier work with different office file formats.

```
<form action="https://documentserver/cool/convert-to/docx" enctype="multipart/form-data" method="post">     
File: <input type="file" name="data"><br/>     
<input type="submit" value="Convert to DOCX">
</form>
```

Further enhancements here comprise:

- [UserCanNotWriteRelative](https://api.onlyoffice.com/editors/wopi/restapi/checkfileinfo#UserCanNotWriteRelative) property in the CheckFileInfo WOPI operation which specifies if a user has permissions to create new files on the WOPI server or not;
- [PutRelativeFile](https://api.onlyoffice.com/editors/wopi/restapi/putrelativefile) WOPI operation which creates a new file on the host based on the current file.

## Inserting external data in spreadsheets

The newly added [document.referenceData](https://api.onlyoffice.com/editors/config/document#referenceData) parameter defines an object that is generated by the integrator to uniquely identify a file in its system.

Together with the implemented [setReferenceData](https://api.onlyoffice.com/editors/methods#setReferenceData) method and [onRequestReferenceData](https://api.onlyoffice.com/editors/config/events#onRequestReferenceData) event, it is now possible to refresh data using a link to a file — when a user is trying to update values inserted from the external file by clicking the corresponding button in the External links dialog box. [Learn more](https://api.onlyoffice.com/editors/insertingexternaldata)

```
var onRequestReferenceData = function () {
var referenceData =  event.data.referenceData;
var path = event.data.path;
   ...
docEditor.setReferenceData({
 "fileType": "xlsx",
 "path": "sample.xlsx",
 "referenceData": {
"fileKey": "BCFA2CED",
"instanceId": "https://example.com"
 },
 "url": "https://example.com/url-to-example-document.xlsx"
 });
};
var docEditor = new DocsAPI.DocEditor("placeholder", {
"events": {
"onRequestReferenceData": onRequestReferenceData, 
 ...
    },
 ...
});
```

## Interface customization

Users of ONLYOFFICE Docs Developer Edition with the extended license get new options for customizing the frontend of the editors via the config file:

- adjusting the font of the interface elements such as buttons, tabs, etc.;
- defining the initial value of the right/left panel visibility – displayed or hidden.

## API updates for plugins and macros

- _Sign_ type in the [initDataType](https://api.onlyoffice.com/plugin/config#initDataType) config parameter.
- [GetVBAMacros](https://api.onlyoffice.com/plugin/executemethod/common/getvbamacros) method which returns all VBA macros from the document.
- [OnDropEvent](https://api.onlyoffice.com/plugin/executemethod/common/ondropevent) method which implements the external drag&drop emulation.
- [Spreadsheet Api](https://api.onlyoffice.com/plugin/executemethod/cell) and [Presentation Api](https://api.onlyoffice.com/plugin/executemethod/slide) methods available for the _window.Asc.plugin.executeMethod_.

Check this code example for the _OnDropEvent_ method:

```
window.Asc.plugin.executeMethod("OnDropEvent", [{
  type: "ondrop",
  x : pos.x,
  y : pos.y,
  text : "test text",
  html : "test html"
}]);
```

[**Get the latest version of ONLYOFFICE Docs Developer Edition**](https://www.onlyoffice.com/download-docs.aspx#docs-developer)

## API updates for Document Builder

In the [DocBuilder API](https://api.onlyoffice.com/docbuilder/basic), we added lots of new comment, table of contents/figure, and some other methods, including the following ones:

- ApiBlockLvlSdt/AddComment
- ApiComment/GetAutorName
- ApiDocument/AddTableOfContents
- ApiDocument/AddTableOfFigures
- ApiParagraph/AddCaption
- ApiDocument/GetStatistics

Check the [full list](https://api.onlyoffice.com/docbuilder/changelog#73) of new methods.

**[Download Document Builder](https://www.onlyoffice.com/download-builder.aspx)**

### Useful links

[What’s new in ONLYOFFICE Docs 7.3](https://dev.to/onlyoffice/onlyoffice-docs-developer-edition-version-73-released-5ep7)

[ONLYOFFICE Docs 7.3.3 with the vulnerability fix](https://www.onlyoffice.com/blog/2023/03/cve-2022-47412-in-onlyoffice/) 

[Updated Helm for ONLYOFFICE Docs](https://github.com/ONLYOFFICE/Kubernetes-Docs/blob/master/CHANGELOG.md#302) 

[API documentation](https://api.onlyoffice.com/)

[API changelog](https://api.onlyoffice.com/editors/changelog)

[Plugins & macros changelog](https://api.onlyoffice.com/plugin/changelog)

[DocBuilder changelog](https://api.onlyoffice.com/docbuilder/changelog)