preview-office-docs

A React component to embed and preview office documents on website using Microsoft's officeapps.live.com .

Usage no npm install needed!

<script type="module">
  import previewOfficeDocs from 'https://cdn.skypack.dev/preview-office-docs';
</script>

README

preview-office-docs

A React component to embed and preview office documents on website using Microsoft's officeapps.live.com .

NPM JavaScript Style Guide

Install

npm install --save preview-office-docs

Requirements

Files urls must be publicly accessible over internet

Supported formats .ppt .xls .doc .odt .ods .odp

Uses Microsoft officeapps . Check their terms when using .

Usage

import React, { Component } from 'react'

import Preview from 'preview-office-docs'

class Example extends Component {
  render() {
    return (
      <div>
        <Preview
          url='https://file-examples-com.github.io/uploads/2017/08/file_example_PPT_250kB.ppt'
          height='700px'
          width='800px'
        />

        <Preview
          url='https://file-examples-com.github.io/uploads/2017/02/file_example_XLS_10.xls'
          height='700px'
          width='800px'
        />

        <Preview
          url='https://file-examples-com.github.io/uploads/2017/02/file-sample_100kB.doc'
          height='700px'
          width='800px'
        />

        <Preview
          url='https://file-examples-com.github.io/uploads/2017/10/file-sample_100kB.odt'
          height='700px'
          width='800px'
        />

        <Preview
          url=' https://file-examples-com.github.io/uploads/2017/10/file_example_ODS_10.ods'
          height='700px'
          width='800px'
        />

        <Preview
          url='https://file-examples-com.github.io/uploads/2017/10/file_example_ODP_200kB.odp'
          height='700px'
          width='800px'
        />
      </div>
    )
  }
}

Props

prop is description example
url required url of the hosted file https://file-examples-com.github.io/uploads/2017/02/file-sample_100kB.doc
height optional height of preview component 500px
width optional width of preview component 500px

License

MIT © yatheeshraju