pageOffice测试

main
yangmengchuan 2 days ago
parent 8b3f7e8647
commit 3ff90e8e30
  1. 11
      pom.xml
  2. 27
      src/main/java/com/keyware/htey/config/PageOfficeConfig.java
  3. 14
      src/main/java/com/keyware/htey/controller/IndexController.java
  4. 8
      src/main/resources/application.yml
  5. 16
      src/main/resources/templates/bootMarkPage.html
  6. 14
      src/main/resources/templates/index.html
  7. 24
      src/main/resources/templates/simpleWord.html

@ -62,6 +62,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- Mybatis-plus-->
<dependency>
<groupId>com.baomidou</groupId>
@ -123,6 +127,13 @@
<artifactId>shiro-core</artifactId>
<version>1.10.0</version>
</dependency>
<!-- pageOffice集成-->
<dependency>
<groupId>com.zhuozhengsoft</groupId>
<artifactId>pageoffice</artifactId>
<version>6.4.1.2-javax</version>
</dependency>
</dependencies>
<build>

@ -0,0 +1,27 @@
package com.keyware.htey.config;
import com.zhuozhengsoft.pageoffice.poserver.Server;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class PageOfficeConfig {
@Value("${posyspath}")
private String poSysPath;
@Bean
public ServletRegistrationBean pageofficeRegistrationBean() {
Server poserver = new Server();
poserver.setSysPath(poSysPath); // 设置PageOffice注册成功后,license.lic文件存放的目录
ServletRegistrationBean srb = new ServletRegistrationBean(poserver);
srb.addUrlMappings("/poserver.zz");
srb.addUrlMappings("/poclient");
srb.addUrlMappings("/pageoffice.js");
srb.addUrlMappings("/sealsetup.exe");
return srb;
}
}

@ -0,0 +1,14 @@
package com.keyware.htey.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class IndexController {
@GetMapping("/")
public String index(Model model) {
model.addAttribute("message", "Hello from Spring Boot!");
return "index"; // 返回 templates/index.html
}
}

@ -16,6 +16,12 @@ spring:
connection-timeout: 30000
maximum-pool-size: 10
minimum-idle: 5
thymeleaf:
prefix: classpath:/templates/ # 模板文件路径
suffix: .html # 文件后缀
cache: false # 开发时禁用缓存,方便调试
mode: HTML # 模板模式
encoding: UTF-8 # 文件编码
# hertzbeat暴露指标接口
management:
endpoints:
@ -40,6 +46,8 @@ springdoc:
api-docs:
path: /v3/api-docs # OpenAPI JSON 的访问路径
enabled: true # 是否启用 OpenAPI JSON
# pageOffice存放目录
posyspath: D:/pageoffice
hertz:
server: http://172.16.36.140:1157
userName: admin

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<table>
<tr>
<td>
<inpu type=""></inpu>
</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script type="text/javascript" src="/pageoffice.js"></script>
<body>
<a href="javascript:POBrowser.openWindow('simpleWord/openFile','width=1150px;height=900px;');">
在线打开文档
</a>
</body>
</html>

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>最简单的打开保存文件</title>
</head>
<body>
<div style="width:100%; height:800px;" th:utext="${poHtmlCode}"></div>
<script>
function Save() {
pageofficectrl.WebSave();
}
//打开书签页面
function openBootMark(){
window.location.href = "/simpleWord/bootMarkPage";
}
function OnPageOfficeCtrlInit() {
pageofficectrl.AddCustomToolButton("保存", "Save", 1);
pageofficectrl.AddCustomToolButton("书签", "openBootMark", 2);
}
</script>
</body>
</html>
Loading…
Cancel
Save