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.
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)How is this guide?