Word Document Import Configuration
This section describes how to configure Word document import. Before v8.0.0, this was set via the toolbar.importWord
option. New in v8.0.0
Default Configuration
{
importWord: {
maxSize: 1024 * 1024 * 5, // 5MB
options: {},
useCustomMethod: false,
async onCustomImportMethod() {
},
},
}
Configuration Options
Note: In Umo Editor Next, the importWord
option has been removed. Please use the import.office
option instead. See Umo Editor Next - Document Import.
Umo Editor Next uses server-side conversion and supports formats such as: doc, docx, xls, xlsx, ppt, pptx, odp, odt, ods, rtf, wps, et, dps, etc. You can also extend the supported formats.
importWord.maxSize
Description: Maximum file size allowed for import, in bytes (B). Default is 5MB. It is not recommended to set this too high to avoid performance issues after import.
Type: Number
Default: 1024 * 1024 * 5
importWord.options
Description: Options for Mammoth. See Mammoth for details.
Type: Object
Default: {}
importWord.useCustomMethod
Description: Whether to use a custom method to import Word files. If set to true
, the onCustomImportMethod
function will be used for importing Word documents. Default is false
.
Type: Boolean
Default: false
importWord.onCustomImportMethod
Description: Custom method for importing Word documents. To use this, set importWord.useCustomMethod
to true
.
Type: Function
Default: undefined
Parameters:
file
: Word document file object. See File for details.
Return Value: Should match the data format returned by Mammoth.convertToHtml(). Example:
{
value: '<p>Hello world</p>',
messages: [
{
type: 'success',
message: 'Converted 1 paragraph',
},
],
}