一、修改必要参数

修改地址参数

(1)修改配置文件settings.properties

(2)修改回调地址(editor.jsp - сonnectEditor - config )

"callbackUrl":"http://192.168.0.105:8081/CallBackServlet?"+"fileName=<%= Model.document.title %>",

配置正确的CallBackServlet地址

检查url是否正确(editor.jsp - сonnectEditor - url)
url为OnlyOffice获取打开文件的地址,文件下载地址。需要OnlyOffice服务能够访问。

二、API详解

1. 页面嵌入OnlyOffice

  • 创建一个空的html文件。
  • 添加div元素,如下所示。
<div id="placeholder"></div>
  • 使用将用于网页的JavaScript API,指向OnlyOffice文档服务器链接。
<script type="text/javascript" src="https://192.168.0.190:9000/web-apps/apps/api/documents/api.js"></script>
  • 添加脚本初始化文件编辑器的DIV与您要打开的文档的配置元素。
new DocsAPI.DocEditor("placeholder", {"document": {"fileType": "docx","key": "Khirz6zTPdfd7","title": "Example Document Title.docx","url": "https://example.com/url-to-example-document.docx"},"documentType": "text"
});

2. 打开文档数据交互格式

{type: 'desktop or mobile',width: '100% by default',height: '100% by default',documentType: 'text' | 'spreadsheet' | 'presentation',document: {title: 'document title',url: 'document url'fileType: 'document file type',options: <advanced options>,key: 'key',vkey: 'vkey',info: {author: 'author name', // must be deprecated, use owner insteadowner: 'owner name',folder: 'path to document',created: '<creation date>', // must be deprecated, use uploaded insteaduploaded: '<uploaded date>',sharingSettings: [{user: 'user name',permissions: '<permissions>',isLink: false},...]},permissions: {edit: <can edit>, // default = truedownload: <can download>, // default = truereader: <can view in readable mode>,review: <can review>, // default = editprint: <can print>, // default = truerename: <can rename>, // default = falsechangeHistory: <can change history>, // default = false // must be deprecated, check onRequestRestore event insteadcomment: <can comment in view mode> // default = edit,modifyFilter: <can add, remove and save filter in the spreadsheet> // default = truemodifyContentControl: <can modify content controls in documenteditor> // default = truefillForms:  <can edit forms in view mode> // default = edit || review}},editorConfig: {mode: 'view or edit',lang: <language code>,location: <location>,canCoAuthoring: <can coauthoring documents>,canBackToFolder: <can return to folder> - deprecated. use "customization.goback" parameter,createUrl: 'create document url',sharingSettingsUrl: 'document sharing settings url',fileChoiceUrl: 'source url', // for mail merge or image from storagecallbackUrl: <url for connection between sdk and portal>,mergeFolderUrl: 'folder for saving merged file', // must be deprecated, use saveAsUrl insteadsaveAsUrl: 'folder for saving files'licenseUrl: <url for license>,customerId: <customer id>,region: <regional settings> // can be 'en-us' or lang codeuser: {id: 'user id',name: 'user name'},recent: [{title: 'document title',url: 'document url',folder: 'path to document'},...],templates: [{name: 'template name',icon: 'template icon url',url: 'http://...'},...],customization: {logo: {image: url,imageEmbedded: url,url: http://...},customer: {name: 'SuperPuper',address: 'New-York, 125f-25',mail: 'support@gmail.com',www: 'www.superpuper.com',info: 'Some info',logo: ''},about: true,feedback: {visible: false,url: http://...},goback: {url: 'http://...',text: 'Go to London',blank: true,requestClose: false // if true - goback send onRequestClose event instead opening url},chat: true,comments: true,zoom: 100,compactToolbar: false,leftMenu: true,rightMenu: true,hideRightMenu: false, // hide or show right panel on first loadingtoolbar: true,statusBar: true,autosave: true,forcesave: false,commentAuthorOnly: false,showReviewChanges: false,help: true,compactHeader: false,toolbarNoTabs: false,toolbarHideFileName: false,reviewDisplay: 'original',spellcheck: true,compatibleFeatures: false,unit: 'cm' // cm, pt, inch,mentionShare : true // customize tooltip for mention},plugins: {autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],pluginsData: ["helloworld/config.json","chess/config.json","speech/config.json","clipart/config.json",]}},events: {'onAppReady': <application ready callback>,'onBack': <back to folder callback>,'onDocumentStateChange': <document state changed callback>'onDocumentReady': <document ready callback>}
}
项目 Value
电脑 $1600
手机 $12
导管 $1
Column 1 Column 2
centered 文本居中 right-aligned 文本居右
字段名 类型 取值 描述 其他
type string desktop、mobile、embedded 标记文档打开的样式类型。 desktop:桌面mobile:移动端embedded:嵌入网页
height string 100% 文档高度
width string 100% 文档宽度
documentType string text、spreadsheet、presentation text: .doc, .docm, .docx, .dot, .dotm, .dotx, .epub, .fodt, .htm, .html, .mht, .odt, .ott, .pdf, .rtf, .txt, .djvu, .xpsspreadsheet:.csv, .fods, .ods, .ots, .xls, .xlsm, .xlsx, .xlt, .xltm, .xltxpresentation:.fodp, .odp, .otp, .pot, .potm, .potx, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx)
document Object 文档
fileType string docx、xlsx、pptx等(文件扩展名) docx、xlsx、pptx等
key string 定义服务用于文档识别的唯一文档标识符。如果发送已知密钥,则文档将从缓存中获取。每次编辑和保存文档时,都必须重新生成密钥。文档url可以用作密钥,但没有特殊字符,长度限制为20个符号。
title string 为已查看或编辑的文档定义所需的文件名,该文件名在下载文档时也将用作文件名。
url string 文档地址, 用于onlyoffice获取文档
document-info Object 包含文档的其他参数(文档作者,存储文档的文件夹,创建日期,共享设置);
document-permissions Object 定义是否可以编辑和下载文档;
editorConfig Object 定义与编辑器界面有关的参数:打开模式(查看器或编辑器),界面语言,附加按钮等)
callbackUrl string 应用服务的回调地址, 处理onlyoffice编辑服务返回的数据及事件
mode string 界面是编辑还是预览 view、edit
createUrl string 定义文档创建保存的绝对URL,文档将在其中创建并在创建后可用。 如果未指定,则不会有创建按钮。
lang string 界面语言配置 zh-CN简体中文;en英文
editorConfig-customization Object 自定义编辑器
editorConfig-user Object 定义当前正在查看或编辑文档的用户:

示例:

{"document": {"fileType": "docx","key": "Khirz6zTPdfd7","title": "Example Document Title.docx","url": "https://example.com/url-to-example-document.docx"},"documentType": "text"
}

3.文档事件及处理
status:事件状态

1 - document is being edited,

2 - document is ready for saving,

3 - document saving error has occurred,

4 - document is closed with no changes,

6 - document is being edited, but the current document state is saved,

7 - error has occurred while force saving the document.

Status 1 is received every user connection to or disconnection from
document co-editing. His callbackUrl is used.

Status 2 (3) is received 10 seconds after the document is closed for
editing with the identifier of the user who was the last to send the
changes to the document editing service. The callbackUrl from the user
who made the last changes to the file is used.

Status 4 is received after the document is closed for editing with no
changes by the last user. His callbackUrl is used.

Status 6 (7) is received when the force saving request is performed.
The callbackUrl from the user who made the last changes to the file is
used.

url:文档下载地址
The link is present when the status value is equal to 2 or 3only.
状态值为2、3时,url有效

key:文档的标识符

示例:

{"key": "-1266895302","status": 6,"url": "http://192.168.0.190:9000/cache/files/-1266895302_4754/output.docx/output.docx?md5=X86S3iBrkJ1kldjVcDBEuw&expires=1585546371&disposition=attachment&filename=output.docx","changesurl": "http://192.168.0.190:9000/cache/files/-1266895302_4754/changes.zip/changes.zip?md5=FmcrkAC4A7O3aGBWTgazuw&expires=1585546371&disposition=attachment&filename=changes.zip","history": {"serverVersion": "5.5.0","changes": [{"created": "2020-03-30 05:17:47","user": {"id": "78ele841","name": "John Smith"}}]},"users": ["78ele841"],"lastsave": "2020-03-30T05:17:47.446Z","forcesavetype": 1
}

OnlyOffice官方Demo必要的修改及参数解释相关推荐

  1. LWIP初体验-修改ST官方demo

    目录 01.硬件说明 02.修改步骤 03.效果显示 04.使用中断方式 05.Keil工程的修改 06.移植TCP客户机代码 01.硬件说明 为什么要写这篇文章?STM32的网络应用还是个复杂的外设 ...

  2. 想了解 spring-cloud-kubernetes,那就先来实战一把官方demo

    本文分享自华为云社区<spring-cloud-kubernetes官方demo运行实战>,作者: 程序员欣宸 . 关于spring-cloud-kubernetes spring-clo ...

  3. Jetson nano (4GB B01) 系统安装,官方Demo测试 (目标检测、手势识别)

    Jetson nano (4GB B01) 系统安装,官方Demo测试 (目标检测.手势识别) 此文确保你可以正确搭建jetson nano环境,并跑通官方"hello AI world&q ...

  4. 蚂蚁区块链官方Demo解析(java版)及相关接口调用

    前言 该文档内容为蚂蚁区块链上的相关技术以及未解决的问题,以BaaS提供的Demo为基础,进行相关API的调用与测试. 蚂蚁区块链文档:https://tech.antfin.com/docs/2/7 ...

  5. CORE-ESP32C3|eink|墨水屏日历+时间日期+温度显示|I2C软件模拟| LuatOS-SOC接口|官方demo|学习(14):墨水屏动态日历+oled日期显示+ AHT10测温模组

    目录 参考博文 源于网友oled+eink+aht10项目 源代码修改及复现说明 主要修改 显示效果 ​编辑硬件准备 软件版本 日志及soc下载工具 软件使用 接线说明 天气显示屏 硬件接线 温度采集 ...

  6. Qt5官方demo解析集11——Qt Quick Particles Examples - Affectors

    本系列所有文章可以在这里查看http://blog.csdn.net/cloud_castle/article/category/2123873 接上文Qt5官方demo解析集10--Qt Quick ...

  7. React-native 官方 demo

    React-native 官方 demo 按官网提供方式安装 java jdk1.8.x, python 2.7.x, android-studio, android-sdk 配置jdk, andro ...

  8. Qt5官方demo分析集29——Extending QML - Property Value Source Example

    此系列的所有文章都可以在这里查看http://blog.csdn.net/cloud_castle/article/category/2123873 接上文Qt5官方demo解析集28--Extend ...

  9. gRPC学习记录(四)--官方Demo

    了解proto3后,接下来看官方Demo作为训练,这里建议看一遍之后自己动手搭建出来,一方面巩固之前的知识,一方面是对整个流程更加熟悉. 官方Demo地址: https://github.com/gr ...

最新文章

  1. -bash: sz: command not found
  2. 最全pandas函数用法速查手册(高清版)
  3. UITableView取消选中颜色、常用操作
  4. Celery - 一个懂得 异步任务 , 定时任务 , 周期任务 的芹菜
  5. 将每个字典一行一行的添加到pd.DataFrame中
  6. 使用Nagios监控esx、esxi、vcenter
  7. 1526B. I Hate 1111
  8. (九)模型驱动和属性驱动
  9. Fiddler4入门——手机抓包
  10. 基于PHP+MySQL图书管理系统的设计与实现
  11. 实现简单的英文字母大小写转换
  12. Project甘特图使用方法
  13. 基于yolov5的目标检测火龙果
  14. 手机自带html怎么卸载,手机自带软件怎么卸载
  15. 随笔2022.12.6
  16. 游戏服务器没有响应怎么回事,求助!!!为什么我进不了游戏!!!
  17. 程序员这条路,选择深耕技术,还是全面学习比较好?
  18. Dell PowerEdge全系服务器RAID卡驱动程序 下载地址
  19. NOIP2013提高组 day2
  20. 软件工程学生考试系统

热门文章

  1. ideagit更新一个文件_IDEA 配置 Git,GitHub, 获取项目, 更新项目 (Windows 版本)
  2. Faster-RCNN论文细节原理解读+代码实现gluoncv(MXNet)
  3. 珍爱生命,远离微软,一点感受源自知乎上的某人评论
  4. socket中结构与函数
  5. win10/11上一键切换全拼/双拼
  6. 数字藏品交易平台开发 数字藏品交易网站开发
  7. 新装的linux设置root密码
  8. 2018最新APP界面设计教程---手机ui高级实战案例 视频教程(价值320元)
  9. char* 和 char[]区别
  10. 来来来!java程序员个人优势