API roundup: latest updates for ONLYOFFICE Docs
From updated customization options to SDKs and AI-powered macro generation, these updates are designed to boost productivity and creativity for every developer and integrator. Here’s a detailed breakdown of what’s new.
What’s new for Docs integration
We’ve rolled out updates to our SDKs for integrating ONLYOFFICE editors into your own apps and services. The latest versions of the Java and PHP SDKs bring enhanced format support, new configuration options, and the addition of a brand-new viewer type — Diagram. Let’s take a closer look at what’s new.
Java SDK 1.6.0
Available on Maven Central the newly updated Java SDK makes available:
- New viewer type: Diagram. The SDK now supports initializing ONLYOFFICE Diagram viewer, introduced in version 9.0.
- New configuration fields. Compatible with editor version 9.0, allowing more granular control over editor initialization.
- Updated list of supported formats. Ensures compatibility with the latest document, spreadsheet, presentation, form, and diagram file types.
- Dependency updates. All components with known vulnerabilities have been updated to improve security and stability.
PHP SDK 1.3.0
Available on Packagist the new version of PHP SDK supports:
- New viewer type: Diagram. Developers can now integrate ONLYOFFICE Diagram viewer, ideal for flowcharts, mind maps, and more.
- Support for viewing
.odg
and.md
files. Expands file compatibility for open formats and Markdown files. - Support for editing
.xlsb
files. You can now integrate editing capabilities for Excel binary workbooks. - New empty file templates. Added for the following languages: Catalan (ca-ES), Czech (cs-CZ), Danish (da-DK), Hungarian (hu-HU), Indonesian (id-ID), Romanian (ro-RO), Albanian (sq-AL), Urdu (ur-PK).
- Minimum compatible editor version: 8.0. Please ensure your ONLYOFFICE Docs instance is up to date for full compatibility.
We recommend all developers integrating ONLYOFFICE editors to update to the latest SDK versions to take advantage of the new features and maintain compatibility with ONLYOFFICE Docs 8.0 and higher.
What’s new for Docs API
Customization FAQ. We’ve added more answers to your frequently asked questions, providing insight into lesser-known customization options.
- How to disable feature tips in the editors to maintain a cleaner interface.
- How to change the font and text size for a customized editor layout.
- How to hide active user icons and usernames in the editor header for enhanced privacy.
New Office API examples. To support diverse use cases, we’ve introduced new document creation samples with practical applications.
- Two-column layouts. Quickly generate professional documents, such as brochures or reports, in a compact two-column format.
- Landscape layouts. Create landscape-oriented pages ideal for accommodating wide tables and charts.
- Text watermarks. Automate the insertion of semi-transparent “Confidential” watermarks to uphold document security.
- Event invitations. Design invites with predefined dimensions and personalized messages for events.
What’s new for plugins and macros
Updated macro customization. With the release of version 9.0.3, we’ve improved the behavior of the customization.macros parameter. Setting macros
to false
now entirely disables macro functionality. It means that users cannot run, add, or edit macros; the Macros button is hidden from the View tab.
const config = {
editorConfig: {
customization: {
...
macros: false,
...
AI-powered macro generation. The integration of AI into macro development greatly accelerates the process of creating macros for ONLYOFFICE.
Starting with version 9.0, the AI plugin can generate macro templates from textual descriptions, saving hours of manual effort. Learn more
Moreover, you can automatically convert VBA code into ONLYOFFICE JavaScript-based macros.
Here are three examples of the macros converted from VBA using AI:
- Unmerge all cells. Simplify spreadsheet formatting by removing all cell merges in one command.
- Convert formulas into values. Quickly convert dynamic calculations into static data for consistency.
- Change cell value. Automate customization for specific cells.
Check out an example macro for changing the value of the selected cell:
(function(){
// Get the active sheet
var activeSheet = Api.GetActiveSheet();
// Select cell A1
activeSheet.GetRange("A1").Select();
// Set the value of the selected cell to "Hello World"
activeSheet.GetRange("A1").SetValue("Hello World");
})();
Asynchronous calculations. Add asynchronous custom functions to manage any request within the function body. Check a sample of calculating World Bank indicator.
New macro samples. Expand your capabilities with new macro examples that simplify document workflows (plus, make use of the added instruction on how to run a macro sample).
By incorporating these macros, you can reduce manual overhead and improve operational efficiency:
- Autofill fields
- Autofit text fields
- Insert calculations
- Limit number of characters
- Modify list values
- Remove default values
- Set placeholder
- Bold bullet points
- Generate outline
- Remove duplicate slides
- Remove slides
- Find invalid emails
Check out the code sample for setting a placeholder:
(function () {
let key = "MyKey";
let placeholderText = "Placeholder";
let doc = Api.GetDocument();
doc.GetAllForms()
.filter(field => field.GetFormType() === "comboBoxForm" && field.GetFormKey() === key)
.forEach(field => field.SetPlaceholderText(placeholderText));
})();
Create your free ONLYOFFICE account
View, edit and collaborate on docs, sheets, slides, forms, and PDF files online.