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

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

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

- Requested language: `ja-JP`

- Content language: `ja-JP`

- Documentation version: `1.2.0`

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

---

#### Package metadata

```json
{
  "preset": [],
  "plugins": [
    {
      "client": "@univerjs-pro/exchange-client",
      "facade": "@univerjs-pro/exchange-client/facade"
    },
    {
      "client": "@univerjs-pro/boards-exchange-client",
      "locale": "@univerjs-pro/boards-exchange-client/locale/ja-JP",
      "style": "@univerjs-pro/boards-exchange-client/lib/index.css",
      "facade": "@univerjs-pro/boards-exchange-client/facade"
    }
  ],
  "license": true,
  "server": true
}
```

`@univerjs-pro/boards-exchange-client` は Mermaid ソースのインポートと PPTX ファイルのエクスポートに対応しています。

## 対応形式

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

| インポート           | エクスポート  |
| --------------- | ------- |
| Mermaid ソーステキスト | `.pptx` |

## 最初に Board ランタイムを登録する

```ts
univer.registerPlugin(UniverBoardsPlugin)
univer.registerPlugin(UniverBoardsUIPlugin)
univer.registerPlugin(UniverBoardsExchangeClientPlugin)
```

対象の要素を含む可能性があるデータをインポートする場合は、事前にオプションの要素プラグインを登録します。

```ts
univer.registerPlugin(UniverBoardsTablePlugin)
univer.registerPlugin(UniverBoardsTableUIPlugin)
univer.registerPlugin(UniverBoardsMindPlugin)
univer.registerPlugin(UniverBoardsMindUIPlugin)
```

## スナップショットの受け渡し

アプリケーションレベルでデータを永続化するには、Board のスナップショットを保存し、復元します。

```ts
const board = univerAPI.getActiveBoard()
const snapshot = board.getData()

univer.createUnit(UniverInstanceType.UNIVER_BOARD, snapshot)
```

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

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

const file = await univerAPI.exportBoardByUnitIdAsync(board.getId())
if (file) univerAPI.downloadFile(file, 'board', 'pptx')
await board.insertMermaidAsync('flowchart LR\n  A[下書き] --> B[レビュー]')
```

PPTX のエクスポートには [Univer Server SDK](https://docs.univer.ai/ja-JP/server/import-export.md) で変換バックエンドを組み込み、Board スナップショットへの対応を確認します。[クライアントライセンス](https://docs.univer.ai/ja-JP/server/license.md)は別途設定します。ブラウザープラグインの登録だけでは変換 API は提供されません。

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

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

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