Onlyoffice api

来自ling
跳转至: 导航搜索

官网

api.onlyoffice

基础使用

 <div id="placeholder"></div>
 <script type="text/javascript" src="https://documentserver/web-apps/apps/api/documents/api.js"></script>
 var docEditor = new DocsAPI.DocEditor("placeholder", config);

How it works

组成

The client side includes:

  • Document manager - the list of the documents displayed in the user browser where the user can select the necessary document and perform some actions with it (depending on the provided rights, the user can open the document to view it or edit, share the document with other users).
  • Document editor - the document viewing and editing interface with all the most known document editing features available, used as a medium between the user and the document editing service.

The server side includes:

  • Document storage service - the server service which stores all the documents available to the users with the appropriate access rights. It provides the document IDs and links to these documents to the document manager which the user sees in the browser.
  • Document editing service - the server service which allows to perform the document viewing and editing (in case the user has the appropriate rights to do that). The document editor interface is used to access all the document editing service features.
  • Document command service - the server service which allows to perfom additional commands with document editing service.
  • Document conversion service - the server service which allows to convert the document file into the appropriate Office Open XML format (docx for text documents, xlsx for spreadsheets and pptx for presentations) for their editing or downloading.

Please note, that ONLYOFFICE Document Server includes the document editor, document editing service, document command service and document conversion service. The document manager and document storage service are either included to Community Server or must be implemented by the software integrators who use ONLYOFFICE Document Server on their own server.

Opening file

Onlyoffice-opening.jpg

Saving file

Onlyoffice-saving.jpg

  1. By the request to the document command service with the forcesave value in the c parameter. The forcesavetype parameter will have the 0 value when sending the request to the callback handler.
  2. Enable the editorConfig.customization.forcesave mode setting it to true in the editor initialization configuration. In this case each time the user clicks the Save button, the forcesave will be done, and the forcesavetype parameter will have the 1 value when sending the request to the callback handler.
  3. You can enable the repeating forcesave start in the Document Server configuration file, which can be found at the following path:
    1. For Linux - /etc/onlyoffice/documentserver/default.json.
    2. For Windows - %ProgramFiles%\ONLYOFFICE\DocumentServer\config\default.json.

Coediting

https://api.onlyoffice.com/editors/coedit

Onlyoffice-coedit.jpg

  • User 1 and user 2 open one and the same document in document editor, i.e. when opening the file one and the same document.key has been used.
  • User 1 makes changes to the opened document.
  • The document editor sends changes made by user 1 to the document editing service.
  • The document editing service sends the changes made by user 1 to the user 2 document editor.
  • Now these changes become visible to user 2.

Converting and downloading file

https://api.onlyoffice.com/editors/conversion

Onlyoffice-conversion.jpg

conversionapi

https://api.onlyoffice.com/editors/conversionapi

Document history

https://api.onlyoffice.com/editors/history