openDocumentByData
Release 2.18.2405+, Release 3.0.2405+
Opens a document directly from converted data.
Parameters
| Name | Type | Description |
|---|---|---|
data.docType | string | Document type — "WORD", "CELL", or "SLIDE" |
data.serializedData | Number[] | Document model serialized for client use |
data.importPath | string | Path (browser-accessible relative path) where the converted file is extracted |
data.importImageMap | object | (optional) Map from image resource key → accessible image URL |
data.name | string | (optional) File name |
data.size | number | (optional) File size (bytes) |
Example
const DOC_TYPE = editor.constructor.CONST.DOC_TYPE;
const data = {};
data.docType = DOC_TYPE.WORD;
data.serializedData = [10, 213, 156, /* ... */];
data.importPath = 'works/36a43f36f442b5824c6b061eb734553d';
data.name = 'editor-intro.docx';
data.size = 71914;
editor.openDocumentByData(data);
// If data.name has an extension, derive docType:
editor.util.getDocType(data.name.split('.').pop()); // 'WORD'