我们可以通过easy-office来实现在线编辑word,excel,power point并集成到自己的网站里去。
添加easy-office.jar到项目
@Configuration
public class ServletConfig {
@Autowired
private ServerConfig serverConfig;
@Bean
public ServletRegistrationBean office() {
OfficeServlet officeServlet = new OfficeServlet();
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(
officeServlet, "/office/*");
servletRegistrationBean.addInitParameter("rootPath", serverConfig.getUploadPath());
return servletRegistrationBean;
}
}
private R openAppendix(SysAppendixEntity sysAppendixEntity, Boolean readOnly) {
try {
OfficeRegister officeRegister = OfficeRegister.getInstance();
officeRegister.setKey("key");
officeRegister.setRequestUrl(HttpContextUtils.getDomain() + "/office/");
String absolutePath = getFile(sysAppendixEntity).getAbsolutePath();
String replace = absolutePath.replace(serverConfig.getUploadPath(), "").replace("\\", "/");
String register = officeRegister.register("/" + replace, readOnly);
return R.ok().put("data", register);
} catch (Exception e) {
e.printStackTrace();
return R.error();
}
}
window.location.href = res.data
将百度云中net.zip解压缩,安装操作系统对应的exe安装程序
将百度云中offce.zip解压缩,以管理元权限执行office.exe
office在线编辑演示
需要的可以联系qq:1005471232,微信17521764260
1000元可以集成到自己的服务器。