0.0.2 • Published 8 months ago

react-office-next v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

文件预览

  • 1、安装

npm install react-office-next --save

  • 2、使用
import ReactOfficeViewer from 'react-office-next'
import 'react-office-next/dist/style.css'
{/* <ReactOfficeViewer file={'/files/xxxxx.docx'} fileName='xxxxx.docx' /> */}
{/* <ReactOfficeViewer file={'/files/xxxxx.pdf'} fileName='xxxxx.pdf' /> */}
{/* <ReactOfficeViewer file={'/files/hlm.txt'} fileName='红楼梦.txt' /> */}
{/* <ReactOfficeViewer file={'/files/出勤率.xls'} fileName='出勤率.xls' /> */}
 <ReactOfficeViewer file={'/files/演示文稿1.pptx'} fileName='演示文稿1.pptx' />
  • 3、注意

注::pptx文件实现预览,需要拷贝dist/statics目录下到项目所在服务根目录下,即通过 http://${origin}/statics/ 能访问相应的资源文件

参数说明

  • file : File对象或者是file的Url地址
  • fileName: 文件显示名称,需要带文件类型后缀,否则可能识别错误
  • timeout: 文件超时时间,默认 2601000 -> 2分钟

文件类型支持

  • doc docx
  • xls xlsx
  • txt
  • pptx
  • pdf
  • image