openDocumentOnServer
Release 2.4.1+
Imports a document using a server API endpoint and parameters.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
api | string | — | Server API endpoint to call for import |
params | object | — | Parameters to pass with the import request |
overwrite | boolean | true | Whether to overwrite the current content. true: overwrite the document. false: insert at the caret position. |
headers | object | — | Release 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);