# インポートとエクスポート

- Human documentation: [https://docs.univer.ai/ja-JP/guides/slides/features/import-export](https://docs.univer.ai/ja-JP/guides/slides/features/import-export)

- Agent Markdown: [https://docs.univer.ai/ja-JP/guides/slides/features/import-export.md](https://docs.univer.ai/ja-JP/guides/slides/features/import-export.md)

- Requested language: `ja-JP`

- Content language: `ja-JP`

- Documentation version: `1.2.0`

- Source: [slides/features/import-export.ja-JP.mdx](https://github.com/dream-num/documentation/blob/dev/content/guides/slides/features/import-export.ja-JP.mdx)

---

以下のブラウザー API を使用する前に[インポート・エクスポート統合](https://docs.univer.ai/ja-JP/server/import-export.md)を完了してください。アップロード、変換、タスク照会、認可されたダウンロードの契約をアプリ側で実装します。スナップショット API にも変換バックエンドが必要です。[Exchange サンプル](https://docs.univer.ai/ja-JP/server/collaboration/examples.md#exchange)は Sheets を対象とするため、他の製品や形式の対応状況は個別に確認してください。

#### Package metadata

```json
{
  "preset": [],
  "plugins": [
    {
      "client": "@univerjs-pro/exchange-client",
      "facade": "@univerjs-pro/exchange-client/facade"
    },
    {
      "client": "@univerjs-pro/slides-exchange-client",
      "facade": "@univerjs-pro/slides-exchange-client/facade"
    }
  ],
  "license": true,
  "server": true
}
```

## 対応形式

以下は本ページのブラウザー API が対応する形式です。Office ファイルの変換には、同じドキュメント種類と形式に対応したバックエンドが必要です。

| インポート           | エクスポート  |
| --------------- | ------- |
| `.ppt`, `.pptx` | `.pptx` |

## Facade API

Plugin モードでは facade パッケージを一度インポートします。

```ts
import '@univerjs-pro/exchange-client/facade'
import '@univerjs-pro/slides-exchange-client/facade'
```

PPTX をサーバー側 unit としてインポートします。

```ts
const unitId = await univerAPI.importSlideToUnitIdAsync(file)
```

PPTX をローカルの slide データとしてインポートします。

```ts
const slideData = await univerAPI.importSlideToSnapshotAsync(file)

if (slideData) {
  univerAPI.createPresentation(slideData)
}
```

現在の slide deck をエクスポートします。

```ts
const presentation = univerAPI.getActivePresentation()
const file = await univerAPI.exportSlideBySnapshotAsync(presentation.save())
```

サーバー側の slide unit をエクスポートします。

```ts
const file = await univerAPI.exportSlideByUnitIdAsync(unitId)
```

## 組み込みのインポート・エクスポートメニューと UI 操作の削除

Univer の組み込みインポート・エクスポートメニューと UI 操作は削除されました。基盤となるサービスと Facade API は引き続き利用できます。

既存のインポート・エクスポートメニューと UI 操作が必要な場合は、[組み込みインポート・エクスポートメニューと UI 操作の移行例](https://office.univer.ai/showcase/slides/custom-import-export)を参考に、カスタムプラグインで移行できます。サンプルの完全なソースコードは、オンラインで閲覧・ダウンロードできます。
