最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時間:2021年08月11日 10:38:03   作者:悲雨嘆風(fēng)  
這篇文章主要介紹了Springboot整合PageOffice 實現(xiàn)word在線編輯保存,本文以Samples5 為示例文件結(jié)合示例代碼給大家詳細介紹,需要的朋友可以參考下

一、查看官網(wǎng)

http://www.zhuozhengsoft.com/

點擊首頁下載,進入頁面:

在這里插入圖片描述

最新得5.2,我們就下載5.2版本進行測試。

二、查看下載包

在這里插入圖片描述

Samples5 為示例文件。放入tomcat中得webapps可以直接訪問。
localhost:8080/Samples5/index.html集成文件 里面有我們需要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的服務(wù)器端授權(quán)程序Servlet(必須)
     * @return
     */
    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        com.zhuozhengsoft.pageoffice.poserver.Server poserver = new com.zhuozhengsoft.pageoffice.poserver.Server();
        //設(shè)置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;');" rel="external nofollow" >打開文件</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("提示:文檔已被修改,是否繼續(xù)關(guān)閉放棄保存 ?"))
            {
                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的調(diào)用代碼 開始 -----
        PageOfficeCtrl poCtrl=new PageOfficeCtrl(request);
        poCtrl.setServerPage("/poserver.zz");//設(shè)置授權(quán)程序servlet
        poCtrl.addCustomToolButton("保存","Save()",1); //添加自定義按鈕
        poCtrl.addCustomToolButton("打印", "PrintFile()", 6);
        poCtrl.addCustomToolButton("全屏/還原", "IsFullScreen()", 4);
        poCtrl.addCustomToolButton("關(guān)閉", "CloseFile()", 21);
        poCtrl.setSaveFilePage("/page/save");//設(shè)置保存的action
        poCtrl.webOpen("D:\\page\\test.docx", OpenModeType.docAdmin,"張三");
        poCtrl.setCaption("信息平臺");
        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: 8080
spring:
  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頁面模板配置
  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.注意

項目結(jié)構(gòu)

在這里插入圖片描述

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

三、測試

 輸入網(wǎng)址

http://localhost:8080/page/index

在這里插入圖片描述

打開文件,或讓你先進行下載pageoffice。

注意事項

  1. 關(guān)閉瀏覽器進行安裝
  2. 二要進行企業(yè)注冊,隨便填填
  3. test.docx得文件需要填寫些數(shù)據(jù)??瘴臋n打不開!

 四、gitee地址

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

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

相關(guān)文章

  • Springboot詳細講解RocketMQ實現(xiàn)順序消息的發(fā)送與消費流程

    Springboot詳細講解RocketMQ實現(xiàn)順序消息的發(fā)送與消費流程

    RocketMQ作為一款純java、分布式、隊列模型的開源消息中間件,支持事務(wù)消息、順序消息、批量消息、定時消息、消息回溯等,本篇我們了解如何實現(xiàn)順序消息的發(fā)送與消費
    2022-06-06
  • 詳解使用Spring Security進行自動登錄驗證

    詳解使用Spring Security進行自動登錄驗證

    本篇文章主要介紹了詳解使用Spring Security進行自動登錄驗證,非常具有實用價值,需要的朋友可以參考下
    2017-09-09
  • SpringMVC mybatis整合實例代碼詳解

    SpringMVC mybatis整合實例代碼詳解

    這篇文章主要介紹了springmvc與mybatis實例詳解的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
    2017-04-04
  • SpringBoot在生產(chǎn)快速禁用Swagger2的方法步驟

    SpringBoot在生產(chǎn)快速禁用Swagger2的方法步驟

    這篇文章主要介紹了SpringBoot在生產(chǎn)快速禁用Swagger2的方法步驟,使用注解關(guān)閉Swagger2,避免接口重復(fù)暴露,非常具有實用價值,需要的朋友可以參考下
    2018-12-12
  • Spring中常見的7種BeanDefinition詳解

    Spring中常見的7種BeanDefinition詳解

    在?Spring?容器中,我們廣泛使用的是一個一個的?Bean,BeanDefinition?從名字上就可以看出是關(guān)于?Bean?的定義,下面就跟隨小編一起深入了解一下常見的7中BeanDefinition吧
    2023-09-09
  • 使用Spring Validation實現(xiàn)數(shù)據(jù)校驗的代碼詳解

    使用Spring Validation實現(xiàn)數(shù)據(jù)校驗的代碼詳解

    在現(xiàn)代Web應(yīng)用開發(fā)中,數(shù)據(jù)校驗是不可忽視的重要環(huán)節(jié),Spring提供了強大的數(shù)據(jù)校驗框架——Spring Validation,可以有效提升數(shù)據(jù)輸入的安全性與應(yīng)用的穩(wěn)定性,本文將介紹如何使用Spring Validation進行數(shù)據(jù)校驗,幫助您深入理解和靈活應(yīng)用這一技術(shù)
    2024-11-11
  • 淺談java中HashMap鍵的比較方式

    淺談java中HashMap鍵的比較方式

    今天帶大家了解一下java中HashMap鍵的比較方式,文中有非常詳細的解釋說明及代碼示例,對正在學(xué)習(xí)java的小伙伴們很有幫助,需要的朋友可以參考下
    2021-05-05
  • java模擬cookie登陸操作

    java模擬cookie登陸操作

    這篇文章主要為大家詳細介紹了java模擬cookie登陸操作,模擬登陸,取得cookie以記錄身份,下次請求時發(fā)送cookie以表明身份,感興趣的小伙伴們可以參考一下
    2016-07-07
  • JavaWeb項目中JSP訪問的問題解決

    JavaWeb項目中JSP訪問的問題解決

    JSP文件一般有兩個存放位置,本文主要介紹了JavaWeb項目中JSP訪問的問題解決,具有一定的參考價值,感興趣的可以了解一下
    2024-01-01
  • Java實現(xiàn)在不同線程中運行的代碼實例

    Java實現(xiàn)在不同線程中運行的代碼實例

    這篇文章主要介紹了Java實現(xiàn)在不同線程中運行的代碼,結(jié)合具體實例形式分析了java多線程操作的相關(guān)實現(xiàn)技巧,需要的朋友可以參考下
    2017-04-04

最新評論

铅山县| 娱乐| 明光市| 哈巴河县| 华坪县| 阜新市| 大埔区| 呼图壁县| 阳高县| 楚雄市| 突泉县| 天津市| 马关县| 安国市| 江西省| 玉环县| 萍乡市| 石家庄市| 宜丰县| 普兰店市| 光泽县| 淮南市| 景德镇市| 平度市| 河东区| 体育| 宝鸡市| 白水县| 聊城市| 广西| 乌恰县| 靖远县| 休宁县| 密山市| 贵南县| 沧州市| 新和县| 锡林郭勒盟| 家居| 东阿县| 海晏县|