如何在iframe中显示本地xlsx文件?

时间:2018-07-16 02:11:05

标签: javascript reactjs amazon-s3 xlsx

我正在使用s3上传器将文件上传到S3。在上传文件之前,库会将文件的本地副本存储在名为Preview的变量中:

preview: "blob:http://localhost:8080/229566c0-e9e5-..."

我正在使用此预览Blob在iframe中显示文件的预览:

{this.props.file.type === 'text/plain'
 ? <pre style={{ width: '100%' }}>
    {decodeDataUri(this.state.blob)}
   </pre>
 : <img style={{ width: '100%' }} src={this.state.blob} />}

这适用于以下文件: pdf格式 文本文件 png jpg

我想知道如何显示此本地存储的xlsx文件?我只是得到一个空白的iframe。

0 个答案:

没有答案
相关问题