一、onlyoffice二次開發API
Onlyoffice是一個基於web的office文檔協作平台,可以在網頁上編輯office文檔並實時協作,也可以將文檔安裝在自己的服務器上提供服務。Onlyoffice為開發者提供API,可以在已有的系統中實現文檔協作的功能。只需要將平台和系統相連,就能在自己的系統中實現文檔協作,此功能十分的實用。
下面是一個簡單的onlyoffice二次開發API使用示例:
OnlyOfficeWebSdk.HelloWorld = function () { var officeOpts = {}; officeOpts.documentType = "text"; officeOpts.editorConfig = {customization:{}} var webSdk = new OnlyOfficeWebSdk("https://example.com", officeOpts); webSdk.start(); webSdk.callbacks.docReady = function () { console.log("Document is ready"); webSdk.export("docx", function (result) { console.log(result); }); }; webSdk.callbacks.saved = function () { console.log("Document is saved"); webSdk.getChanges(function (doc) { console.log(doc); }); }; };
二、onlyoffice二次開發集成
Onlyoffice採用RESTful API架構,可以很輕鬆地與其他應用程序集成。與其他應用程序集成可以實現自定義文檔工作流程,提高工作效率。
只需要將文檔管理系統與Onlyoffice相連,就可以在文檔管理系統內部編輯和協作office文檔。
下面是一個onlyoffice二次開發集成示例:
<iframe src="http://example.com/document.aspx?action=edit&id=462&authtoken=53E24778D4464564BB5053C531A6BC9B"/>
三、onlyoffice二次開發詳解
Onlyoffice提供了一套完整的文檔編輯、協作API、數據存儲、共享、擴展等功能,可以方便地進行二次開發。
下面是一個onlyoffice二次開發詳解示例:
OnlyOfficeWebSdk.documentReady = function () { var editorInstance = this; editorInstance.customizeToolbar(["doSave"]); window.setInterval( function() { var hiddenTextArea = editorInstance.getCustomization("textAreaControl"); if (!!hiddenTextArea) { var text = window.mytext; hiddenTextArea.value = text; } }, 2000); };
四、onlyoffice二次開發Python
Onlyoffice二次開發可以使用Python進行開發,Python作為一種腳本語言可以快速開發,提高效率。
下面是一個onlyoffice二次開發Python示例:
from onlyoffice_wrapper import OnlyOffice doc_id = "test_doc" auth_token = "52jm09l01fs99s5a5vdbmiqss0" editor_url = "https://example.com/" onlyoffice = OnlyOffice(doc_id=doc_id, auth_token=auth_token, editor_url=editor_url) onlyoffice.set_file_contents('Hello world!') response = onlyoffice.get_file_contents() print(response.content.decode())
五、onlyoffice二次開發 前端
Onlyoffice二次開發可以進行前端開發,可以根據需求自定義界面與樣式,提升用戶體驗。
下面是一個onlyoffice二次開發前端示例:
$(document).ready(function(){ var editor = new DocsAPI.DocEditor("placeholder", { language: "ru-ru", document: { fileType: "docx", key: "{{{ key }}}", title: "{{{ title }}}", url: "{{{ url }}}", info: { authors: [ { name: "{{ authors.0.name }}", surname: "{{ authors.0.surname }}", }, { name: "{{ authors.1.name }}", surname: "{{ authors.1.surname }}", } ], created: "{{ created }}", modified: "{{ modified }}" } } }); editor.on('ready', function(){ console.log('Document ready') }) });
六、dzzoffice二次開發
Dzzoffice是一個基於web的文檔協作平台,是一種類似於onlyoffice的解決方案。
下面是一個dzzoffice二次開發示例:
public class OnlyofficeConfig { public static final String API_ROOT = "http://example.com/dzzoffice/api/"; ... } Client client = Client.create(); WebResource webResource = client .resource(OnlyofficeConfig.API_ROOT + "document/" + gid + "/info"); ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON).post(ClientResponse.class, reqBody);
以上便是onlyoffice二次開發的一些詳細闡述,API可以根據自己的需求和系統功能進行自由結合,進行系統+文檔協作,提高工作效率。同時也可以使用Python進行快速開發,提升開發效率,根據自己的需要進行自由開發。
原創文章,作者:WFCN,如若轉載,請註明出處:https://www.506064.com/zh-hant/n/144844.html