如何使用 C++ 合併 ODP 文件
為了合併 ODP 文件,我們將使用 Aspose.Slides for C++ API 是一個功能豐富、功能強大且易於使用的 C++ 平台文檔合併 API。可以直接下載最新版本,直接打開 NuGet 包管理器,搜索 Aspose.Slides.Cpp 並安裝。您還可以從包管理器控制台使用以下命令。
命令
PM> Install-Package Aspose.Slides.Cpp
合併 ODP 文件 - C++
// The path to the documents directory.
const String sourceFilePath1 = u"SourceFile2.odp";
const String sourceFilePath2 = u"SourceFile3.odp";
const String outputFilePath = u"mergedOutput.odp";
// Instantiate Presentation class
SharedPtr<Presentation> presentation1 = MakeObject<Presentation>(sourceFilePath1);
SharedPtr<Presentation> presentation2 = MakeObject<Presentation>(sourceFilePath2);
for (SharedPtr<ISlide> slide : presentation2->get_Slides()){
// Merge from source to destination
presentation1->get_Slides()->AddClone(slide);
}
// Save the presentation
presentation1->Save(outputFilePath, SaveFormat::Odp);
在 C++ 中合併 ODP 文件的步驟
只需幾行代碼即可完成與 Aspose.Slides for C++ API 合併和連接的基本文檔。
- 加載兩個 ODP 文件。
- 使用 get_Slides() 方法遍歷每張幻燈片。
- 使用 AddClone 功能與所需文件合併。
- 使用 Save() 方法保存在指定路徑
系統要求
Aspose.Slides for C++ 支持所有主要平台和操作系統。請確保您具有以下先決條件。
- Microsoft Windows 或具有適用於 Windows 32 位、Windows 64 位和 Linux 64 位的 C++ 運行時環境的兼容操作系統。
- 項目中引用的 C++ DLL 的 Aspose.Slides。
以 Aspose.Slides 建置
線上合併 ODP 檔案
免費的 Aspose.Slides Merger 應用程式以 Aspose.Slides for C++ 建置,與上方程式碼使用的是同一個 API。開啟它,看看 API 能如何處理您自己的 ODP 檔案。
- 在瀏覽器中執行,無需安裝任何軟體。
- 在撰寫程式碼之前,先看看 Aspose.Slides 如何合併檔案。
- 上傳多個 ODP 檔案並將它們合併為一個。
- 將合併結果下載為一個檔案。
什麼是 ODP 文件格式
副檔名為 .ODP 的檔案使用由 OASIS OpenDocument 標準定義的 OpenDocument Presentation 格式。ODP 檔案包含一組投影片,可包括文字、影像、格式、動畫和其他媒體。支援 OpenDocument 簡報的應用程式(例如 LibreOffice Impress 和 Apache OpenOffice Impress)可以開啟 ODP 檔案。
其他支持的合併格式
使用 C++,One 還可以合併許多其他文件格式,包括..