# Python を使用して PPTX ファイルをマージする

> Python で複数の PPTX ファイルをマージします。

Source: https://products.aspose.com/slides/ja/python-net/merge/pptx/
Updated: 2023-04-07



## Python で PPTX をマージする

[**Aspose.Slides for Python via .NET**](https://products.aspose.com/slides/ja/python-net/) は、プレゼンテーション ファイルを作成および操作するための強力な Python ライブラリです。さらに、複数の PPTX プレゼンテーションを柔軟に組み合わせることができます。あるプレゼンテーションを別のプレゼンテーションにマージすると、それらのスライドを効果的に 1 つのプレゼンテーションに結合して 1 つのファイルを取得します。 Aspose.Slides では、2 つのプレゼンテーションを異なる方法でマージできます。品質やデータの損失を心配することなく、プレゼンテーションをすべての形状、スタイル、テキスト、書式、コメント、アニメーションなどと結合できます。

## Python を使用して PPTX ファイルをマージする

PowerPoint プレゼンテーションを結合するには、あるプレゼンテーションから別のプレゼンテーションにスライドを複製する必要があります。

### 複数の PPTX を 1 つのファイルにマージするための Python コード

```python

import aspose.slides as slides

with slides.Presentation("presentation1.pptx") as pres1:
    with slides.Presentation("presentation2.pptx") as pres2:
        for slide in pres2.slides:
            pres1.slides.add_clone(slide)
    pres1.save("presentation.pptx", slides.export.SaveFormat.PPTX)
```

## Aspose.Slides for Python API を使用して PPTX をマージする方法

これらは、Python で 2 つの PPTX ファイルをマージし、結果を PPTX として保存する手順です。

[**Aspose.Slides for Python via .NET**](https://products.aspose.com/slides/ja/python-net/) をインストールします。
```
pip install aspose.slides
```

Python プロジェクトにライブラリ参照を追加 (ライブラリをインポート) します。
```
import aspose.slides as slides
```

Python でソース PPTX ファイルを開きます。
```
pres1 = slides.Presentation('pres1.pptx')
pres2 = slides.Presentation('pres2.pptx')
```

[**add_clone**](https://reference.aspose.com/slides/python-net/aspose.slides/islidecollection/#methods) メソッドを使用して PPTX ファイルを結合します。
```
for slide in pres2.slides:
    pres1.slides.add_clone(slide)
```

プレゼンテーションを保存し、結果を単一の PPTX ファイルとして取得します。
```
pres1.save("result.pptx", slides.export.SaveFormat.PPTX)
```

## PPTX を他のサポートされている形式にエクスポート
