Onlyoffice api
来自ling
目录
官网
基础使用
<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
Saving file
- 用户编辑文档 in the document editor.
- The document editor 发送变更到 the document editing service.
- The user 关闭 document editor.
- The document editing service 监控文档编辑结束,并收集所有document editor的变更发送到一起
- The document editing service 通过callbackUrl告知 the document storage service 编辑结束,参数包括 编辑结束的文档链接
- The document storage service 从document editing service下载包含所有变更的文件,并保存
- Document editing service 允许获取编辑完成前的状态. 这个过程称 ONLYOFFICE Document Server 的forcesave . When forcesave is initiated, document editing service performs request to the callback handler with the link to the document as the url parameter and with the 6 value for the status parameter. The forcesave process can be initiated the following ways:
- 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.
- 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.
- You can enable the repeating forcesave start in the Document Server configuration file, which can be found at the following path:
- For Linux - /etc/onlyoffice/documentserver/default.json.
- For Windows - %ProgramFiles%\ONLYOFFICE\DocumentServer\config\default.json.
Coediting
https://api.onlyoffice.com/editors/coedit
- 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
conversionapi
https://api.onlyoffice.com/editors/conversionapi