Powerpoint、PDF、PPT、またはその他のドキュメントを C# でマージする

PPT、PPTX、PDF、PNG、JPEG、およびその他の形式をマージするための高速 C# ライブラリ。

C# を使用して PPT、PPTX、PDF をマージする

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

C# で PowerPoint プレゼンテーションをマージする

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

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


// Instantiate a Presentation object that represents a target presentation file
using (Presentation presentation1 = new Presentation("presentation1.pptx"))
{
    // Instantiate a Presentation object that represents a source presentation file
    using (Presentation presentation2 = new Presentation("presentation2.pptx"))
    {
        foreach (ISlide slide in presentation2.Slides)
        {
            // Merge slides from source to target 
            presentation1.Slides.AddClone(slide);
        }
    }
    // Save the presentation
    presentation1.Save("merged-presentation.pptx", Export.SaveFormat.Pptx);
}

C# を使用してプレゼンテーションをスライド マスターと結合する

この C# コードは、複数のプレゼンテーションを 1 つに結合し、スライド マスター プレゼンテーション テンプレートからスタイルを適用する方法を示しています。そのため、結果のプレゼンテーションは同じソースの書式設定を保持し、別のプレゼンテーションのマスター スライドの書式設定を含みます。

C#で複数のPPTを1つにマージする


// Instantiate a Presentation object that represents a target presentation file
using (Presentation presentation1 = new Presentation("presentation1.pptx"))
{
    // Instantiate a Presentation object that represents a source presentation file
    using (Presentation presentation2 = new Presentation("presentation2.pptx"))
    {
        // Merge first two slides only using slide master
        presentation1.Slides.AddClone(presentation2.Slides[0], presentation1.Masters[0], true);
        presentation1.Slides.AddClone(presentation2.Slides[1], presentation1.Masters[0], true);
    }
    presentation1.Save("merged-presentation-master.pptx", Export.SaveFormat.Pptx);
}

Aspose.Slides for .NET API を使用してプレゼンテーションをマージする方法

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

  1. Aspose.Slides for .NET をインストールします。

  2. C# プロジェクトにライブラリ参照を追加 (ライブラリをインポート) します。

  3. C# でソース PPTX ファイルを開きます。

  4. AddClone メソッドを使用して PPTX ファイルを結合します。

  5. プレゼンテーションを保存し、結果を単一の PDF ファイルとして取得します。

マージするその他のサポートされている形式

他のファイル形式を組み合わせることもできます。以下のサポートされているその他の形式を参照してください。

OTP (OpenDocument Standard Format)
POT (Microsoft PowerPoint Template Files)
POTM (Microsoft PowerPoint Template File)
POTX (Microsoft PowerPoint Template Presentation)
PPS (PowerPoint Slide Show)
PPSM (Macro-enabled Slide Show)
PPSX (PowerPoint Slide Show)
PPT (Microsoft PowerPoint 97-2003)
PPTM (Macro-enabled Presentation File)
PPTX (Open XML presentation Format)