A viewer and editor for Word and Excel files that runs in the browser
Open, edit and save docx, xlsx, doc, xls and RTF files in your page.
What it does
Installation
From a CDN, one line:
<script src="https://cdn.jsdelivr.net/npm/bymoffice@0.1.0/dist/bymoffice.min.js"></script>
With npm:
npm i bymoffice
Showing a file in a box:
<div id="editor" style="height: 600px"></div>
<script src="https://cdn.jsdelivr.net/npm/bymoffice@0.1.0/dist/bymoffice.min.js"></script>
<script>
BymOffice.mount(document.getElementById('editor'), {
file: '/files/report.xlsx', // a URL, a File/Blob, an ArrayBuffer or a Uint8Array
locale: 'tr',
onSave: (bytes) => console.log('Ctrl+S:', bytes.length, 'bytes'),
});
</script>
// npm:
import { mount } from 'bymoffice';
await mount(document.getElementById('editor'), { file, fontsUrl: '/assets/bymoffice-fonts/' });
The API in detail is in the developer guide. Developer guide