kkFileView Spring Boot 构建 Excel 文件在线预览项目方案 项目简介
file-online-preview此项目为文件文档在线预览项目解决方案,在取得公司高层同意后以 Apache 协议开源出来反哺社区。该项目基本支持主流办公文档的在线预览,如 doc,docx,Excel,pdf,txt,zip,rar,图片等等在线体验请善待公共服务,会不定时停用地址:http://58.246.254.194:8012/文档预览效果Excel预览效果doc预览效果zip,rar压缩预览效果png,jpeg,jpg等图片预览效果,支持滚轮缩放,旋转,倒置等考虑说明篇幅原因,就不贴其他格式文件的预览效果了,感兴趣的可以参考下面的实例搭建下快速开始项目使用技术spring boot: spring boot开发参考指南freemarkerredissonjodconverter依赖外部环境redisOpenOffice或者LibreOffice第一步:pull项目https://github.com/kekingcn/file-online-preview.git第二步:配置redis地址和OpenOffice目录,如server.port = 8012
spring.http.encoding.charset = utf8
## Freemarker 配置
spring.freemarker.template-loader-path = classpath:/web/
spring.freemarker.cache = false
spring.freemarker.charset = UTF-8
spring.freemarker.check-template-location = true
spring.freemarker.content-type = text/html
spring.freemarker.expose-request-attributes = true
spring.freemarker.expose-session-attributes = true
spring.freemarker.request-context-attribute = request
spring.freemarker.suffix = .ftl
#=============================================#spring Redisson配置#===================================#
spring.redisson.address = 192.168.1.204:6379
##资源映射路径(因为jar方式运行的原因)
file.dir = C:\\Users\\yudian\\Desktop\\dev\\
spring.resources.static-locations = classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${file.dir}
## openoffice相关配置
openOfficePath = /Applications/OpenOffice.app/Contents
office.home = C:\\Program Files (x86)\\OpenOffice 4
server.tomcat.uri-encoding = UTF-8
converted.file.charset = GBK
#======================================#文件上传限制#======================================#
spring.http.multipart.max-file-size=100MB第三步:运行FilePreviewApplication的main方法,服务启动后,访问http://localhost:8012/ 会看到如下界面,代表服务启动成功
spring.http.encoding.charset = utf8
## Freemarker 配置
spring.freemarker.template-loader-path = classpath:/web/
spring.freemarker.cache = false
spring.freemarker.charset = UTF-8
spring.freemarker.check-template-location = true
spring.freemarker.content-type = text/html
spring.freemarker.expose-request-attributes = true
spring.freemarker.expose-session-attributes = true
spring.freemarker.request-context-attribute = request
spring.freemarker.suffix = .ftl
#=============================================#spring Redisson配置#===================================#
spring.redisson.address = 192.168.1.204:6379
##资源映射路径(因为jar方式运行的原因)
file.dir = C:\\Users\\yudian\\Desktop\\dev\\
spring.resources.static-locations = classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:${file.dir}
## openoffice相关配置
openOfficePath = /Applications/OpenOffice.app/Contents
office.home = C:\\Program Files (x86)\\OpenOffice 4
server.tomcat.uri-encoding = UTF-8
converted.file.charset = GBK
#======================================#文件上传限制#======================================#
spring.http.multipart.max-file-size=100MB第三步:运行FilePreviewApplication的main方法,服务启动后,访问http://localhost:8012/ 会看到如下界面,代表服务启动成功