色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

Springboot整合PageOffice 實(shí)現(xiàn)word在線編輯保存功能

瀏覽:100日期:2022-06-15 11:38:34
目錄一、查看官網(wǎng)二、查看下載包三、測(cè)試 四、gitee地址一、查看官網(wǎng)

http://www.zhuozhengsoft.com/

點(diǎn)擊首頁(yè)下載,進(jìn)入頁(yè)面:

Springboot整合PageOffice 實(shí)現(xiàn)word在線編輯保存功能

最新得5.2,我們就下載5.2版本進(jìn)行測(cè)試。

二、查看下載包

Springboot整合PageOffice 實(shí)現(xiàn)word在線編輯保存功能

Samples5 為示例文件。放入tomcat中得webapps可以直接訪問(wèn)。localhost:8080/Samples5/index.html集成文件 里面有我們需要jar包

新建springboot項(xiàng)目以及簡(jiǎn)單測(cè)試這里就不多說(shuō)了。

1、springboot 引入 pageoffice5.2.0.12.jar

Springboot整合PageOffice 實(shí)現(xiàn)word在線編輯保存功能

2、springboot 引入thymleaf

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

3、編寫(xiě)配置文件

/** * PageOffice 配置類(lèi) */@Configurationpublic class PageOfficeConfig { @Value('${file.save.path}') String poSysPath; /** * 添加PageOffice的服務(wù)器端授權(quán)程序Servlet(必須) * @return */ @Bean public ServletRegistrationBean servletRegistrationBean() {com.zhuozhengsoft.pageoffice.poserver.Server poserver = new com.zhuozhengsoft.pageoffice.poserver.Server();//設(shè)置PageOffice注冊(cè)成功后,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、編寫(xiě) 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='https://rkxy.com.cn/jquery.min.js'></script> <script type='text/javascript' src='https://rkxy.com.cn/pageoffice.js' id='po_js_main'></script> <!-- end --></head><body><a href='javascript:POBrowser.openWindowModeless(’word’,’width=1200px;height=800px;’);' rel='external nofollow' >打開(kāi)文件</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 type='button' value='隱藏/顯示 標(biāo)題欄' onclick='return Button1_onclick()' /><input type='button' value='隱藏/顯示 菜單欄' onclick='return Button2_onclick()' /><input type='button' value='隱藏/顯示 自定義工具欄' onclick='return Button3_onclick()' /><input type='button' value='隱藏/顯示 Office工具欄' onclick='return Button4_onclick()' /><div 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('提示:文檔已被修改,是否繼續(xù)關(guān)閉放棄保存 ?')) {return true; }else{return false; }} } // 隱藏/顯示 標(biāo)題欄 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、編寫(xiě)PageOfficeController

/** * PageOffice Demo */@Controller@RequestMapping('/page')public class PageOfficeController { /** * 進(jìn)入測(cè)試 * @return */ @RequestMapping(value='/index', method=RequestMethod.GET) public ModelAndView showIndex(){ModelAndView mv = new ModelAndView('index');return mv; } /** * office online打開(kāi) * @param request * @param map * @return */ @RequestMapping(value='/word', method=RequestMethod.GET) public ModelAndView showWord(HttpServletRequest request, Map<String,Object> map){//--- PageOffice的調(diào)用代碼 開(kāi)始 -----PageOfficeCtrl poCtrl=new PageOfficeCtrl(request);poCtrl.setServerPage('/poserver.zz');//設(shè)置授權(quán)程序servletpoCtrl.addCustomToolButton('保存','Save()',1); //添加自定義按鈕poCtrl.addCustomToolButton('打印', 'PrintFile()', 6);poCtrl.addCustomToolButton('全屏/還原', 'IsFullScreen()', 4);poCtrl.addCustomToolButton('關(guān)閉', 'CloseFile()', 21);poCtrl.setSaveFilePage('/page/save');//設(shè)置保存的actionpoCtrl.webOpen('D:pagetest.docx', OpenModeType.docAdmin,'張三');poCtrl.setCaption('信息平臺(tái)');map.put('pageoffice',poCtrl.getHtmlCode('PageOfficeCtrl1'));//--- PageOffice的調(diào)用代碼 結(jié)束 -----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: 8080spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/test?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=UTC username: root password: finn123 # thymeleaf頁(yè)面模板配置 thymeleaf: prefix: classpath:/templates/ suffix: .html mvc: view: prefix: classpath:/templates/ suffix: .html resources: static-locations: classpath:/templates/,classpath:/static/file: save: path: d:/page/

7.注意

項(xiàng)目結(jié)構(gòu)

Springboot整合PageOffice 實(shí)現(xiàn)word在線編輯保存功能

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

三、測(cè)試

輸入網(wǎng)址

http://localhost:8080/page/index

Springboot整合PageOffice 實(shí)現(xiàn)word在線編輯保存功能

打開(kāi)文件,或讓你先進(jìn)行下載pageoffice。

注意事項(xiàng)

關(guān)閉瀏覽器進(jìn)行安裝 二要進(jìn)行企業(yè)注冊(cè),隨便填填 test.docx得文件需要填寫(xiě)些數(shù)據(jù)。空文檔打不開(kāi)! 四、gitee地址

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

到此這篇關(guān)于Springboot整合PageOffice 實(shí)現(xiàn)word在線編輯保存的文章就介紹到這了,更多相關(guān)Springboot整合PageOffice內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: word
相關(guān)文章:
主站蜘蛛池模板: 久久视频6免费观看视频精品 | 亚洲一级网站 | 欧美一级片手机在线观看 | 国产自产v一区二区三区c | 国产亚洲欧美久久精品 | 热99re久久精品香蕉 | 免费男女视频 | 美国毛片一级视频在线aa | 欧美特级一级毛片 | 国产成人精品在视频 | 色偷偷成人网免费视频男人的天堂 | 九九九热视频 | 欧美老妇免费做爰视频 | 日本亚州视频在线八a | 天堂最新版 | 亚洲国产精选 | 国产精品亚洲二区在线 | 久操视频免费在线观看 | 免费a级在线观看播放 | 亚洲免费在线 | 欧美视频精品 | 欧美日本韩国一区 | 亚洲一级毛片免观看 | 欧美一级毛片生活片 | 国产精品漂亮美女在线观看 | 在线观看日本免费视频大片一区 | 日韩欧美一区二区三区不卡在线 | 欧美成人www在线观看网页 | 男女很舒服爽视频免费 | 亚洲乱人伦精品图片 | 露脸 在线 国产 眼镜 | 在线观看欧洲成人免费视频 | 欧美日本一区二区三区生 | 日本精品三级 | 男人的天堂视频在线 | 日韩一区二区三 | 日本人成在线视频免费播放 | 国产精品久久国产精品99 | 久久久久久久久免费影院 | 91小视频在线观看免费版高清 | 亚洲精品aaa |