Nextcloud ONLYOFFICE integration app
How to integrate ONLYOFFICE Docs with Nextcloud
Close
×
This app enables users to edit office documents from using ONLYOFFICE Docs.
The latest connector signed versions are available in the official store for Nextcloud.
- Currently, the following document formats can be opened and edited with this app: DOCX, XLSX, PPTX, CSV, TXT, DOCXF, OFORM.
- The following format is available for viewing only: PDF.
- The following formats can be converted into OOXML: DOC, DOCM, DOT, DOTX, EPUB, HTM, HTML, ODP, ODT, POT, POTM, POTX, PPS, PPSM, PPSX, PPT, PPTM, RTF, XLS, XLSM, XLT, XLTM, XLTX.
- The app will create an item in the new (+) menu to create Document, Spreadsheet, Presentation. It will also create a new Open in ONLYOFFICE menu option within the document library for Office documents. This allows multiple users to collaborate in real time and to save back those changes to Nextcloud. Co-editing is also available between several federated Nextcloud instances connected to one Document Server.
Installing ONLYOFFICE Docs
You will need an instance of ONLYOFFICE Docs (Document Server) that is resolvable and connectable both from Nextcloud and any end clients. If that is not the case, use the official . ONLYOFFICE Docs must also be able to POST to Nextcloud directly.
ONLYOFFICE Docs and Nextcloud can be installed either on different computers, or on the same machine. In case you select the latter variant, you will need to set up a custom port for Document Server as by default both ONLYOFFICE Docs and Nextcloud work on port 80. Or you can use Document Server behind a proxy, please refer to this article to learn how you can configure it.
The easiest way to start an instance of ONLYOFFICE Docs is to use .
You can also use our Docker installation to get installed and configured Document Server and Nextcloud installation with a couple of commands.
If the server with the Nextcloud installed does not have the Internet access, or if you need it for some other reason, the administrator can install the application manually. To start using ONLYOFFICE Docs with Nextcloud, the following steps must be performed:
- Go to the Nextcloud server apps/ directory (or some other directory used to connect applications): cd apps/
- Change the owner to update the application right from Nextcloud web interface: chown -R www-data:www-data onlyoffice
- In Nextcloud, open the ~/settings/apps/disabled page with Not enabled apps by administrator and click Enable for the ONLYOFFICE application.
Configuring Nextcloud ONLYOFFICE integration app
In Nextcloud, open the ~/settings/admin/onlyoffice page with administrative settings for ONLYOFFICE section. Enter the following address to connect ONLYOFFICE Docs:
where the documentserver is the name of the server with the ONLYOFFICE Docs installed. The address must be accessible for the user browser and from the Nextcloud server. The Nextcloud server address must also be accessible from ONLYOFFICE Docs for correct work.
Sometimes your network configuration might not allow the requests between installed Nextcloud and ONLYOFFICE Docs using the public addresses. The Advanced server settings allows to set the ONLYOFFICE Docs address for internal requests from Nextcloud server and the returning Nextcloud address for the internal requests from ONLYOFFICE Docs. You need to enter them in the appropriate fields.
Starting from version 7.2, JWT is enabled by default and the secret key is generated automatically to restrict the access to ONLYOFFICE Docs and for security reasons and data integrity. Specify your own Secret key in the Nextcloud administrative configuration. In the ONLYOFFICE Docs , specify the same secret key and enable the validation.
Enable or disable the Open file in the same tab setting.
You can check the connection to ONLYOFFICE Docs by using the following occ command:
occ onlyoffice:documentserver —check
You will see a text either with information about the successful connection or the cause of the error.
How it works
The ONLYOFFICE integration follows the API documented here.
- When creating a new file, the user navigates to a document folder within Nextcloud and clicks the Document, Spreadsheet or Presentation item in the new (+) menu.
- The browser invokes the create method in the /lib/Controller/EditorController.php controller. This method adds a copy of a file from the assets folder to the folder the user is currently in.
- When opening an existing file, the user navigates to it within Nextcloud and selects the Open in ONLYOFFICE menu option.
- A new browser tab is opened and the index method of the /lib/Controller/EditorController.php controller is invoked.
The app prepares a JSON object with the following properties:
- url - the URL that ONLYOFFICE Docs uses to download the document;
- callbackUrl - the URL that ONLYOFFICE Docs informs about status of the document editing;
- key - the UUID+Modified Timestamp to instruct ONLYOFFICE Docs whether to download the document again or not.
- Nextcloud takes this object and constructs a page from templates/editor.php template, filling in all of those values so that the client browser can load up the editor.
- The client browser makes a request to the JavaScript library from ONLYOFFICE Docs and sends ONLYOFFICE Docs the DocEditor configuration with the above properties.
- Then ONLYOFFICE Docs downloads the document from Nextcloud and the user begins editing.
- ONLYOFFICE Docs sends a POST request to callbackUrl to inform Nextcloud that a user is editing the document.
- When all users and client browsers are done with editing, they close the editing window.
- After of inactivity, ONLYOFFICE Docs sends a POST to callbackUrl letting Nextcloud know that the clients have finished editing the document and closed it.
- Nextcloud downloads a new version of the document, replacing the old one.
- Connecting external storages. Adding the storage using the External storages app has issues with the co-editing in some cases. If the connection is made using the same authorization keys (the Username and password or Global credentials authentication type is selected), then the co-editing is available for the users. If different authorization keys are used (Log-in credentials, save in database or User entered, store in database authentication options), the co-editing is not available. When the Log-in credentials, save in session authentication type is used, the files cannot be opened in the editor.
Validating certificate. If you are using a self-signed certificate for your Document Server, Nextcloud will not validate such a certificate and will not allow connection to/from Document Server. This issue can be solved in two ways:
- Check the Disable certificate verification (insecure) box on the ONLYOFFICE administration page, Server settings section, within your Nextcloud.
- Change the Nextcloud config file manually. Locate the Nextcloud config file (/nextcloud/config/config.php) and open it. Insert the following section to it:
This will disable the certificate verification and allow Nextcloud to establish connection with Document Server.
Please remember that this is a temporary insecure solution and we strongly recommend that you replace the certificate with the one issued by some CA. Once you do that, do not forget to uncheck the corresponding setting box or remove the above section from the Nextcloud config file.
Converting files. ONLYOFFICE Docs uses Office Open XML format as a basis when opening and editing files. If the file format is different from OOXML, it will still be converted to the corresponding OOXML for the Document Server proper work and faster performance. After that you can edit the file, making any changes available for the base OOXML format and save the file to this base OOXML format.
Download the Nextcloud ONLYOFFICE integration app .