Import and export
The APIs on this page require a conversion backend. Follow file exchange integration to connect uploads, conversion, task queries, and downloads, then configure the browser plugins. The snapshot APIs also require that backend but do not require a collaborative document. The collaboration Exchange example demonstrates Sheets, so check that the 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 formats that the browser APIs on this page accept. Converting Office files also 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, and export always produces .pptx. The browser API does not accept .pptm, .ppsx, .ppsm, or .potx. Backend support for those formats alone does not make them work in the browser.
Facade API
In plugin mode, import the facade packages once:
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 the Facade APIs remain available.
If the application still needs those menus and UI interactions, the migration example for built-in import/export menus and UI interactions explains how to migrate them to a custom plugin. The example includes complete source code that you can view online or download.
How is this guide?