一、查看官网

http://www.zhuozhengsoft.com/

点击首页下载,进入页面:

最新得5.2,我们就下载5.2版本进行测试。

二、查看下载包

  1. Samples5 为示例文件。放入tomcat中得webapps可以直接访问。
    localhost:8080/Samples5/index.html
  2. 集成文件 里面有我们需要jar包

新建springboot项目以及简单测试这里就不多说了。

1、springboot 引入 pageoffice5.2.0.12.jar

2、springboot 引入thymleaf

       <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>

3、编写配置文件


/*** PageOffice 配置类*/
@Configuration
public class PageOfficeConfig {@Value("${file.save.path}")String poSysPath;/*** 添加PageOffice的服务器端授权程序Servlet(必须)* @return*/@Beanpublic ServletRegistrationBean servletRegistrationBean() {com.zhuozhengsoft.pageoffice.poserver.Server poserver = new com.zhuozhengsoft.pageoffice.poserver.Server();//设置PageOffice注册成功后,license.lic文件存放的目录poserver.setSysPath(poSysPath);ServletRegistrationBean srb = new ServletRegistrationBean(poserver);srb.addUrlMappings("/poserver.zz");srb.addUrlMappings("/posetup.exe");srb.addUrlMappings("/pageoffice.js");srb.addUrlMappings("/jquery.min.js");srb.addUrlMappings("/pobstyle.css");srb.addUrlMappings("/sealsetup.exe");return srb;}}

4、编写 index.html 和 word.html

4.1 index.html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title><!-- office插件js begin 必须引入--><script type="text/javascript" src="/jquery.min.js"></script><script type="text/javascript" src="/pageoffice.js" id="po_js_main"></script><!-- end -->
</head>
<body>
<a href="javascript:POBrowser.openWindowModeless('word','width=1200px;height=800px;');">打开文件</a>
</body>
</html>

4.2 word.html

**<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head><meta charset="UTF-8"><title>Title</title>
</head>
<body><input id="Button1" type="button" value="隐藏/显示 标题栏"  onclick="return Button1_onclick()" />
<input id="Button2" type="button" value="隐藏/显示 菜单栏" onclick="return Button2_onclick()" />
<input id="Button3" type="button" value="隐藏/显示 自定义工具栏"  onclick="return Button3_onclick()" />
<input id="Button4" type="button" value="隐藏/显示 Office工具栏"  onclick="return Button4_onclick()" /><div style="width:1000px;height:700px;" th:utext="${pageoffice}"> </div>
<script type="text/javascript">function Save() {document.getElementById("PageOfficeCtrl1").WebSave();}function PrintFile(){document.getElementById("PageOfficeCtrl1").ShowDialog(4);}function IsFullScreen(){document.getElementById("PageOfficeCtrl1").FullScreen = !document.getElementById("PageOfficeCtrl1").FullScreen;}function CloseFile(){window.external.close();}function BeforeBrowserClosed(){if (document.getElementById("PageOfficeCtrl1").IsDirty){if(confirm("提示:文档已被修改,是否继续关闭放弃保存 ?")){return  true;}else{return  false;}}}// 隐藏/显示 标题栏function Button1_onclick() {var bVisible = document.getElementById("PageOfficeCtrl1").Titlebar;document.getElementById("PageOfficeCtrl1").Titlebar = !bVisible;}// 隐藏/显示 菜单栏function Button2_onclick() {var bVisible = document.getElementById("PageOfficeCtrl1").Menubar;document.getElementById("PageOfficeCtrl1").Menubar = !bVisible;}// 隐藏/显示 自定义工具栏function Button3_onclick() {var bVisible = document.getElementById("PageOfficeCtrl1").CustomToolbar;document.getElementById("PageOfficeCtrl1").CustomToolbar = !bVisible;}// 隐藏/显示 Office工具栏function Button4_onclick() {var bVisible = document.getElementById("PageOfficeCtrl1").OfficeToolbars;document.getElementById("PageOfficeCtrl1").OfficeToolbars = !bVisible;}
</script>
</body>
</html>**

5、编写PageOfficeController


/*** PageOffice Demo*/
@Controller
@RequestMapping("/page")
public class PageOfficeController {/*** 进入测试* @return*/@RequestMapping(value="/index", method=RequestMethod.GET)public ModelAndView showIndex(){ModelAndView mv = new ModelAndView("index");return mv;}/*** office online打开* @param request* @param map* @return*/@RequestMapping(value="/word", method=RequestMethod.GET)public ModelAndView showWord(HttpServletRequest request, Map<String,Object> map){//--- PageOffice的调用代码 开始 -----PageOfficeCtrl poCtrl=new PageOfficeCtrl(request);poCtrl.setServerPage("/poserver.zz");//设置授权程序servletpoCtrl.addCustomToolButton("保存","Save()",1); //添加自定义按钮poCtrl.addCustomToolButton("打印", "PrintFile()", 6);poCtrl.addCustomToolButton("全屏/还原", "IsFullScreen()", 4);poCtrl.addCustomToolButton("关闭", "CloseFile()", 21);poCtrl.setSaveFilePage("/page/save");//设置保存的actionpoCtrl.webOpen("D:\\page\\test.docx", OpenModeType.docAdmin,"张三");poCtrl.setCaption("信息平台");map.put("pageoffice",poCtrl.getHtmlCode("PageOfficeCtrl1"));//--- PageOffice的调用代码 结束 -----ModelAndView mv = new ModelAndView("word");return mv;}/*** 保存* @param request* @param response*/@RequestMapping("/save")public void saveFile(HttpServletRequest request, HttpServletResponse response){FileSaver fs = new FileSaver(request, response);fs.saveToFile("d:\\page\\" + fs.getFileName());fs.close();}}

6.application.yml 配置

server:port: 8080
spring:datasource:driver-class-name: com.mysql.cj.jdbc.Driverurl: jdbc:mysql://localhost:3306/test?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=UTCusername: rootpassword: finn123# thymeleaf页面模板配置thymeleaf:prefix: classpath:/templates/suffix: .htmlmvc:view:prefix: classpath:/templates/suffix: .htmlresources:static-locations: classpath:/templates/,classpath:/static/
file:save:path: d:/page/

7.注意

项目结构

注意jquery.min.js 和 pageoffice.js文件地址

三、测试

输入网址

http://localhost:8080/page/index

打开文件,或让你先进行下载pageoffice。

注意事项

  1. 关闭浏览器进行安装
  2. 二要进行企业注册,随便填填
  3. test.docx得文件需要填写些数据。空文档打不开!

四、gitee地址

https://gitee.com/finn_feng/finnPageOffice.git

参考:
找不到了…

Springboot整合PageOffice 实现word在线编辑保存。相关推荐

  1. 【vue2+onlyoffice】word在线编辑保存

    前言 需要实现word文档的编辑和保存功能,之前写了一篇选方案的. 现在就按照onlyoffice开始实现.[没有使用到多人协同] 正文 1.后端部署(忽略),后端给我了一个地址之后,我运行了一个de ...

  2. ①. SpringBoot整合PageOffice实现在线编辑Word和Excel

    ①. SpringBoot整合PageOffice实现在线编辑Word和Excel PageOffice官网: http://www.zhuozhengsoft.com/ PageOffice集成说明 ...

  3. springboot+Vue整合Luckysheet,实现在线编辑Excel表格

    springboot+Vue整合Luckysheet,实现在线编辑Excel表格 功能:页面嵌入Luckysheet表格组件,能够在线编辑Excel表格,实现表格的读取,保存功能(不支持导出为xls文 ...

  4. springboot整合pageoffice

    需求:在线打开编辑word,并获取word中的数据. 官网下载pageoffice包: 官网地址:卓正软件 - PageOffice官方网站 - 在线编辑Word.Excel的Office文档控件 解 ...

  5. java word编辑_java实现word在线编辑及流转

    [实例简介] java开发web办公系统,调用PageOffice组件实现word在线编辑及流转 [实例截图] [核心代码] worddemo ├── worddemo │   ├── css │   ...

  6. SpringBoot整合微信支付开发在线教育视频网站(完整版)

    目录 ├─code.zip ├─第 1 章项目介绍和前期准备 │  ├─1-1 SpringBoot整合微信支付开发在线教育视频站点介绍.TS │  ├─1-2 中大型公司里面项目开发流程讲解.TS ...

  7. gridfs文件服务器,OWA实现Word在线编辑(以GridFs存储文件)

    OWA全称Office Web App,是用来做Office文档预览的一个很好的工具,通过一些配置文件的设置还可以实现Excel.PowerPoint的在线编辑功能,但对Word在线编辑并不支持.Gi ...

  8. vue中实现及封装html合同文本在线编辑保存的功能

    在vue项目开发中,遇到一个对纯html合同文本进行在线编辑保存的需求,自己用JQuery和iframe摸索着封装了一个组件,遇到相同需求的前端友人可以参考一下,后续还要完善.(贴出完整代码) /封装 ...

  9. libreoffice + jodconverter + Springboot 整合使用将Word转PDF

    libreoffice + jodconverter + Springboot 整合使用将Word转PDF 第一步 安装Libreoffice https://jingyan.baidu.com/ar ...

最新文章

  1. 神经网络中参数量parameters和FLOPs计算
  2. gram矩阵的性质_线性代数(十五)标准正交基(Orthonormal Bases)和Gram-Schmidt正交化...
  3. laravel 分页php_laravel 分页 seo浅谈
  4. Linux内核链表深度分析【转】
  5. Leetcode周赛5193. 删除字符使字符串变好
  6. 阿里云MongoDB,一直被模仿,从未被超越
  7. Filter过滤要登录的页面(重要)
  8. 11产品经理要懂的-人性行为之善良友好的本质
  9. CentOS 6.4 yum安装LAMP环境
  10. thinkphp怎么设置输入网址直接进入首页
  11. 易优CMS:arcview的基础用法
  12. 使用consul注册中心要求服务以自定义instance-id形式注册
  13. 大尺度功能脑组织结构:6个主要原则
  14. jQueryUI皮肤下载、jQgrid中更换皮肤
  15. JS--利用setTimeout模拟setInterval
  16. Python——文档
  17. NC6自助开发文件存放路径及一些总结以及修改自助登录界面的样式、图片、添加文字提示等文件
  18. python二级用的是什么软件_考计算机二级用啥软件练
  19. C语言最大公约数和最小公倍数
  20. Photoshop CS6基本知识1

热门文章

  1. 基于ROS的机械臂手眼标定-基础使用
  2. Android Design Support Library BottomSheetBehavior使用
  3. linux如何查看rman备份,linux下rman备份笔记
  4. van-image怎么使用本地图片
  5. CC++QT开发知识总结
  6. 【连载】【FPGA黑金开发板】Verilog HDL那些事儿--VGA驱动(十)
  7. Mac系统下安装和卸载HomeBrew的方法
  8. 阎王点赞!地府后台管理系统驾到,速来销生死簿名单!附地址
  9. 2021年茶艺师(中级)考试及茶艺师(中级)考试题库
  10. finereport实现报表表头固定