openDocumentByData

2.18.2405 버전부터 지원, 3.0.2405 버전부터 지원합니다.

변환된 데이터에서 직접 문서를 엽니다.

매개변수

이름타입설명
data.docTypestring문서 타입 — "WORD", "CELL", 또는 "SLIDE"
data.serializedDataNumber[]클라이언트 사용을 위해 직렬화된 문서 모델
data.importPathstring변환된 파일이 추출되는 경로(브라우저에서 접근 가능한 상대 경로)
data.importImageMapobject(선택 사항) 이미지 리소스 키와 접근 가능한 이미지 URL을 짝지은 맵
data.namestring(선택 사항) 파일 이름
data.sizenumber(선택 사항) 파일 크기(바이트)

예시

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'