openDocumentOnServer

Release 2.4.1+

Imports a document using a server API endpoint and parameters.

Parameters

NameTypeDefaultDescription
apistringServer API endpoint to call for import
paramsobjectParameters to pass with the import request
overwritebooleantrueWhether to overwrite the current content. true: overwrite the document. false: insert at the caret position.
headersobjectRelease 2.7.0+ Headers to include with the import request

The server API must accept the parameters (typically a file path) and return the import result (serializedData, importPath, etc.).

Example

const api = './importOnServer';
const params = { path: 'D:\\test.docx' };
const overwrite = true;
editor.openDocumentOnServer(api, params, overwrite);