Froala Documentation
- Installation Guides
- Browser Support
- Languages Support
- Shortcuts
- Activation
- Examples
- Customize the Editor
- Use-cases
- Plugins
- APIs
- Development Frameworks
- Server Integrations
- Server SDKs
- Migration Guides
- Changelog
- Tutorials
- Froala Docs
- /
- Plugins
- /
- Import from Word Plugin
Import from Word Plugin
Plugins are fully functional during your trial once you've added your trial key to the setup.
Import .docx files directly into the editor with formatting intact. Headings, lists, and images transfer automatically, with support for both client-side (Mammoth.js) and server-side conversion.
Plugin options:
| importFromWordMaxFileSize Number |
The maximum allowed file size in bytes.
Default: 3 * 1024 * 1024 |
| importFromWordFileTypesAllowed Array |
A list of allowed file extensions.
Default: ['docx'] |
| importFromWordUrlToUpload String |
The URL of a server-side handler for conversion. If null, client-side conversion via mammoth.js is used.
Default: null |
| importFromWordEnableImportOnDrop Boolean |
Whether to trigger the import process when a valid Word file is dropped into the editor.
Default: true |
Plugin methods:
| importFromWord.import (file) | Opens the file selection dialog or processes a provided File object.
● File (object): optional , The File object to be converted and imported. |
Plugin events:
| word.beforeImport (file) | Triggered before the file processing starts. Returning false will cancel the import. |
| word.afterImport (html) | Triggered after the content has been converted and inserted into the editor. |
Dependencies
The Import from Word plugin allows users to import .docx files directly into the Froala Editor. It supports both client-side conversion (via Mammoth.js) and server-side conversion.
For client-side conversion (when importFromWordUrlToUpload is null), the plugin requires Mammoth.js to be loaded on the page:
<script src="https://cdnjs.cloudflare.com/ajax/libs/mammoth/1.4.21/mammoth.browser.min.js"></script>
Add Plugin to your code:
Plugin name: importFromWord
Plugin JS Script: ../js/plugins/import_from_word.min.js
Or from CDN https://cdn.jsdelivr.net/npm/froala-editor@latest/js/plugins/import_from_word.min.js
