Nextcloud ONLYOFFICE integration app
This app enables users to edit office documents from Nextcloud using ONLYOFFICE Document Server. Currently the following document formats can be edited with this app: csv, docx, pptx, txt, xlsx. The above mentioned formats are also available for viewing together with pdf. The edited files of the corresponding type can be converted into the Office Open XML formats: doc, docm, dot, dotx, epub, htm, html, odp, odt, pot, potm, potx, pps, ppsm, ppsx, ppt, pptm, rtf, xls, xlsm, xlsx, 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.
You can also use our Docker installation to get installed and configured Document Server and Nextcloud installation with a couple of commands.
Tested with Nextcloud 12 and 13, the latest connector signed versions are available in the official store for Nextcloud.
Installing ONLYOFFICE Document Server
You will need an instance of ONLYOFFICE Document Server that is resolvable and connectable both from Nextcloud and any end clients (version 4.2.7 and later are supported for use with the app). If that is not the case, use the official ONLYOFFICE Document Server documentation page: Document Server for Linux. ONLYOFFICE Document Server must also be able to POST to Nextcloud directly.
Starting with version 4.3.0, ONLYOFFICE Document Server 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 Document Server 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 Document Server is to use Docker.
Installing Nextcloud ONLYOFFICE integration app
The Nextcloud administrator can install the integration app from the in-built application market. For that go to the user name and select Apps. After that find ONLYOFFICE in the list of available applications and install it.
If the server with the Nextcloud installed does not have an Internet access, or if you need it for some other reason, the administrator can install the application manually. To start using ONLYOFFICE Document Server with Nextcloud, the following steps must be performed:
Configuring Nextcloud ONLYOFFICE integration app
In Nextcloud open thepage with administrative settings for ONLYOFFICE section. Enter the following address to connect ONLYOFFICE Document Server: https://<documentserver>/
Where the documentserver is the name of the server with the ONLYOFFICE Document Server 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 Document Server for correct work.
Sometimes your network configuration might not allow the requests between installed Nextcloud and ONLYOFFICE Document Server using the public addresses. The Advanced server settings allows to set the ONLYOFFICE Document Server address for internal requests from Nextcloud server and the returning Nextcloud address for the internal requests from ONLYOFFICE Document Server. You need to enter them in the appropriate fields.
To restrict the access to ONLYOFFICE Document Server and for security reasons and data integrity the encrypted signature is used. Specify the Secret key in the Nextcloud administrative configuration. In the ONLYOFFICE Document Server config file specify the same secret key and enable the validation.
Enable or disable the Open file in the same tab setting.
The Open in ONLYOFFICE action will be added to the file context menu. You can specify this action as default and it will be used when the file name is clicked for the selected file types.
ONLYOFFICE Document Server 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.
In case the source Nextcloud file format was different from the base one, and you still want to save it to the original format, the file will be converted to this format from OOXML. As the formats are fundamentally different, some data (such as charts, tables, autoshapes or images) and formatting can be lost due to the simple reason that some formats (csv, txt, etc.) do not support them or treat them differently than OOXML standard does. That is why all the non-OOXML files by default are opened for viewing only, although there is an option to convert the file in the context menu. If you realise the data/formatting loss risks after the conversion, but still want to open non-OOXML files for editing, you can check them in the list in the settings. Editing for csv and txt files is available by default.
How it works
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 the copy of the file from the assets folder to the folder the user is currently in.
Or, 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:
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.
Then ONLYOFFICE Document Server downloads the document from Nextcloud and the user begins editing.
ONLYOFFICE Document Server sends a POST request to the callback URL 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 10 seconds of inactivity, ONLYOFFICE Document Server sends a POST to the callback URL letting Nextcloud know that the clients have finished editing the document and closed it.
Nextcloud downloads the new version of the document, replacing the old one.
Download the Nextcloud ONLYOFFICE integration app here.
© Ascensio System SIA 2018. All rights reserved