#预览服务
预览服务基于WPS的在线编辑服务,WPS网站
https://open.wps.cn/docs/wwo/join/platform-overview
申请流程
先注册成为服务商,然后申请服务,笔者申请速度还可以
然后拿到服务的账号和密码
这个是基础服务,后面是EasyPoi-wps的服务
你需要配置回调路径,EasyPoi实现了controller,你需要引用到你的项目中@ComponentScan(basePackages = {“cn.afterturn.easypoi”})
为了避免和其他路径,easypoi在wps的前缀的基础上加上了easypoi/wps/ 回调记得写上
然后如果只是预览,作者也是这样想的,你只要实现两个或者一个方法就可以,什么叫做极简这就是
当然你实现了编辑服务,你可以多实现点
@Service
public class WpsService implements IEasyPoiWpsService {
@Override
public String getAppSecret() {
return "";
}
@Override
public String getAppId() {
return "";
}
// 这个不一定有用
@Override
public int getFileSize(String filepath) {
InputStream is = null;
try {
is = FileLoaderImpl.class.getClassLoader().getResourceAsStream("exceltohtml/" + filepath);
return is.available();
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(is);
}
return 2048;
}
/**这个 根据你的项目,返回一个wps可以访问到的路径就可以了 **/
@Override
public String getDownLoadUrl(String filepath) {
return "http://easypoi.wupaas.com/" + filepath;
}
}
这样,如果没有其他需求,wps的预览就完成了
作者:悟耘信息 创建时间:2020-05-09 17:11
更新时间:2022-09-04 22:15
更新时间:2022-09-04 22:15