欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用Springboot實(shí)現(xiàn)word在線編輯保存

 更新時(shí)間:2021年08月12日 10:19:11   作者:悲雨嘆風(fēng)  
PageOffice目前支持的Web編程語(yǔ)言及架構(gòu)有:Java(JSP、SSH、MVC等),ASP.NET(C#、VB.NET、MVC、Razor等),PHP,ASP,本篇文章就帶你使用Springboot整合PageOffice實(shí)現(xiàn)word在線編輯保存

一、查看官網(wǎng)

http://www.zhuozhengsoft.com/

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

在這里插入圖片描述

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

二、查看下載包

在這里插入圖片描述

1.Samples5 為示例文件。放入tomcat中得webapps可以直接訪問(wèn)。

localhost:8080/Samples5/index.html

2.集成文件 里面有我們需要jar包

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

1、springboot 引入 pageoffice5.2.0.12.jar

在這里插入圖片描述

2、springboot 引入thymleaf

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

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

/**
 * PageOffice 配置類(lèi)
 */
@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注冊(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="/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;');">打開(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 id="Button1" type="button" value="隱藏/顯示 標(biāo)題欄"  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;
            }
        }
    }
    // 隱藏/顯示 標(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)程序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("信息平臺(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: 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頁(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)

在這里插入圖片描述

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

三、測(cè)試

輸入網(wǎng)址

http://localhost:8080/page/index

在這里插入圖片描述

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

注意事項(xiàng)

1.關(guān)閉瀏覽器進(jìn)行安裝

2.二要進(jìn)行企業(yè)注冊(cè),隨便填填

3.test.docx得文件需要填寫(xiě)些數(shù)據(jù)??瘴臋n打不開(kāi)!

四、gitee地址

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

總結(jié)

本篇文章就到這里了,希望能給你帶來(lái)幫助,也希望您能夠多多關(guān)注腳本之家的更多內(nèi)容!

相關(guān)文章

  • Java幾種常用的斷言風(fēng)格你怎么選

    Java幾種常用的斷言風(fēng)格你怎么選

    這篇文章主要介紹了Java幾種常用的斷言風(fēng)格你怎么選,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-01-01
  • SpringMVC中@controllerAdvice注解的詳細(xì)解釋

    SpringMVC中@controllerAdvice注解的詳細(xì)解釋

    剛接觸SpringMVC應(yīng)該很少會(huì)見(jiàn)到這個(gè)注解,其實(shí)它的作用非常大,下面這篇文章主要給大家介紹了關(guān)于SpringMVC中@controllerAdvice注解的相關(guān)資料,需要的朋友可以參考下
    2022-02-02
  • Java中的Semaphore信號(hào)量深入解析

    Java中的Semaphore信號(hào)量深入解析

    這篇文章主要介紹了Java中的Semaphore信號(hào)量深入解析,Semaphore是Java里面另外一個(gè)基本的并發(fā)工具包類(lèi),主要的的作用是用來(lái)保護(hù)共享資源的訪問(wèn)的,也就是僅僅允許一定數(shù)量的線程訪問(wèn)共享資源,需要的朋友可以參考下
    2023-11-11
  • HashMap原理及put方法與get方法的調(diào)用過(guò)程

    HashMap原理及put方法與get方法的調(diào)用過(guò)程

    這篇文章主要介紹了HashMap原理及put方法與get方法的調(diào)用過(guò)程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-09-09
  • Spring MVC中自定義攔截器的實(shí)例講解

    Spring MVC中自定義攔截器的實(shí)例講解

    下面小編就為大家?guī)?lái)一篇Spring MVC中自定義攔截器的實(shí)例講解。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-08-08
  • Java實(shí)現(xiàn)指定目錄下的文件查找詳解

    Java實(shí)現(xiàn)指定目錄下的文件查找詳解

    這篇文章主要介紹了利用Java實(shí)現(xiàn)指定目錄下的文件查找的方法,能做到給出文件名,查找目錄及其子目錄中是否存在或者給出后綴名,查找目錄及其子目錄中相關(guān)的文件,感興趣的可以學(xué)習(xí)一下
    2022-03-03
  • 掌握SpringMVC中@InitBinder的實(shí)際應(yīng)用

    掌握SpringMVC中@InitBinder的實(shí)際應(yīng)用

    這篇文章主要介紹了掌握SpringMVC中@InitBinder的實(shí)際應(yīng)用,@InitBinder是Spring MVC框架中的一個(gè)注解,用于自定義數(shù)據(jù)綁定的方法,通過(guò)在控制器中使用@InitBinder注解,可以將特定的數(shù)據(jù)綁定邏輯應(yīng)用于請(qǐng)求參數(shù)的處理過(guò)程中,需要的朋友可以參考下
    2023-10-10
  • mybatis實(shí)現(xiàn)批量插入并返回主鍵(xml和注解兩種方法)

    mybatis實(shí)現(xiàn)批量插入并返回主鍵(xml和注解兩種方法)

    這篇文章主要介紹了mybatis實(shí)現(xiàn)批量插入并返回主鍵(xml和注解兩種方法),具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-12-12
  • springboot?neo4j的配置代碼

    springboot?neo4j的配置代碼

    小編最近的工作中遇到了一些知識(shí)圖譜的工作,自然就用到了圖數(shù)據(jù)庫(kù),這一NoSQL?數(shù)據(jù)庫(kù)可以很好的展示節(jié)點(diǎn)之間的關(guān)聯(lián)關(guān)系,對(duì)于一些圖譜的關(guān)系操作是很好的選擇,下面來(lái)介紹下?Springboot?配置Neo4J的問(wèn)題
    2021-12-12
  • JAVA匿名內(nèi)部類(lèi)(Anonymous Classes)的具體使用

    JAVA匿名內(nèi)部類(lèi)(Anonymous Classes)的具體使用

    本文主要介紹了JAVA匿名內(nèi)部類(lèi),匿名內(nèi)部類(lèi)在我們JAVA程序員的日常工作中經(jīng)常要用到,文中通過(guò)示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-08-08

最新評(píng)論