C++ で PowerPoint プレゼンテーションを Word 文書に変換
プレゼンテーション(PPT または PPTX)からテキストコンテンツや情報を新しい方法で使用する予定がある場合、プレゼンテーションを Word(DOC または DOCX)に変換すると利点があります。
- Microsoft PowerPoint と比較すると、Microsoft Word アプリはコンテンツ向けのツールや機能がより充実しています。
- Word の編集機能に加えて、コラボレーション、印刷、共有機能も強化されています。
Aspose.Slides と Aspose.Words
PowerPoint ファイル(PPTX または PPT)を Word(DOCX または DOC)に変換するには、Aspose.Slides for C++ と Aspose.Words for C++ の両方が必要です。
単独 API としての Aspose.Slides for C++ は、プレゼンテーションからテキストを抽出する機能を提供します。
Aspose.Words は高度な文書処理 API で、アプリケーションが Microsoft Word を使用せずに、文書の生成、変更、変換、レンダリング、印刷、その他のタスクを実行できます。
PowerPoint プレゼンテーションを Word 文書に変換
PowerPoint を Word に変換するには、以下のコードスニペットを使用してください。
auto presentation = MakeObject<Presentation>();
auto doc = MakeObject<Aspose::Words::Document>();
auto builder = MakeObject<Aspose::Words::DocumentBuilder>(doc);
for (const auto& slide : presentation->get_Slides())
{
// スライド画像を生成して挿入します
auto image = slide->GetImage(1.0f, 1.0f);
builder->InsertImage(image);
// スライドのテキストを挿入します
for (const auto& shape : slide->get_Shapes())
{
if (ObjectExt::Is<AutoShape>(shape))
{
auto autoShape = System::AsCast<AutoShape>(shape);
builder->Writeln(autoShape->get_TextFrame()->get_Text());
}
}
builder->InsertBreak(Aspose::Words::BreakType::PageBreak);
}
FAQ
PowerPoint と OpenDocument プレゼンテーションを Word 文書に変換するためにインストールが必要なコンポーネントは何ですか?
プロジェクトに Aspose.Slides for C++ と Aspose.Words for C++ の各パッケージを追加するだけです。両ライブラリは単独 API として動作し、Microsoft Office をインストールする必要はありません。
すべての PowerPoint および OpenDocument プレゼンテーション形式がサポートされていますか?
Aspose.Slides は すべてのプレゼンテーション形式 をサポートしており、PPT、PPTX、ODP などの一般的なファイルタイプが含まれます。これにより、さまざまなバージョンの Microsoft PowerPoint で作成されたプレゼンテーションを扱うことができます。