Import and export
The APIs below need a conversion backend. Follow file exchange integration to connect uploads, conversion, task queries, and downloads, then configure the browser plugins. Snapshot APIs also need that backend, but do not require a collaborative document. The collaboration Exchange example demonstrates Sheets; check that your target release supports the file types you need.
For export failures, see license error codes and task failure handling.
For imported Office attachments, see OLE previews, online conversion, and export source selection.
Supported formats
The table describes the browser APIs on this page. Office file conversion requires a backend that supports the same document type and format.
| Import | Export |
|---|---|
.ppt, .pptx | .pptx |
Both .ppt and .pptx use the import APIs below. Export produces .pptx. The browser API does not accept .pptm, .ppsx, .ppsm, or .potx; backend format support alone does not enable them in the browser.
Facade API
Import the facade package once in plugin mode:
import '@univerjs-pro/exchange-client/facade'import '@univerjs-pro/slides-exchange-client/facade'Import a PPTX into a server-side unit:
const unitId = await univerAPI.importSlideToUnitIdAsync(file)Import a PPTX as local slide data:
const slideData = await univerAPI.importSlideToSnapshotAsync(file)if (slideData) { univerAPI.createPresentation(slideData)}Export the current slide deck:
const presentation = univerAPI.getActivePresentation()const file = await univerAPI.exportSlideBySnapshotAsync(presentation.save())Export a server-side slide unit:
const file = await univerAPI.exportSlideByUnitIdAsync(unitId)Removal of built-in import/export menus and UI interactions
Note
Starting with version 1.2.0, Univer no longer includes built-in import/export menus and UI interactions. The underlying services and Facade APIs remain available.
If your application needs to retain the existing import/export menus and UI interactions, see the migration example for built-in import/export menus and UI interactions to migrate using a custom plugin. The example provides complete source code for online viewing and download.
How is this guide?