PNG JPG BMP TIFF ODP
Aspose.Slides  for C++

在 C++ 中解析 ODP 格式

使用 C++ API 的服務器端 Aspose.Slides 進行本機和高性能 ODP 文檔解析,無需使用 Microsoft 或 Adob​​e PDF 等任何軟件。

如何使用 C++ 解析 ODP 文件

為了解析 ODP 文件,我們將使用

Aspose.Slides for C++

API 是一個功能豐富、功能強大且易於使用的 C++ 平台文檔解析 API。可以直接下載最新版本,直接打開

NuGet

包管理器,搜索 Aspose.Slides.Cpp 並安裝。您還可以從包管理器控制台使用以下命令。

命令


PM> Install-Package Aspose.Slides.Cpp

在 C++ 中解析 ODP 文件的步驟

使用 Aspose.Slides for C++ API 解析基本文檔只需幾行代碼即可完成。

  1. 加載 ODP 文件。

  2. 獲取第一張幻燈片的 ITextFrame 對像數組。

  3. 循環遍歷 TextFrames 數組

  4. 循環遍歷當前 ITextFrame 中的段落。

  5. 循環瀏覽當前 IParagraph 中的部分。

  6. 顯示文本。

系統要求

Aspose.Slides for C++ 支持所有主要平台和操作系統。請確保您具有以下先決條件。

  • Microsoft Windows 或具有適用於 Windows 32 位、Windows 64 位和 Linux 64 位的 C++ 運行時環境的兼容操作系統。
  • 項目中引用的 C++ DLL 的 Aspose.Slides。
 

解析 ODP 文件 - C++

// Sample file path
const String sourceFilePath = u"SourcePath\sourceFile.odp";

// Load the ODP file
SharedPtr<Presentation> presentation = MakeObject<Presentation>(sourceFilePath);

// Get an Array of ITextFrame objects from the first slide
System::ArrayPtr<SharedPtr<ITextFrame>> textFramesSlideOne = SlideUtil::GetAllTextBoxes(presentation->get_Slides()->idx_get(0));

// Loop through the Array of TextFrames
for (int i = 0; i get_Length(); i++){
	// Loop through paragraphs in current ITextFrame
	for (SharedPtr<IParagraph> paragraph : textFramesSlideOne[i]->get_Paragraphs()){
		// Loop through portions in the current IParagraph
		for (SharedPtr<IPortion> portion : paragraph->get_Portions()){
			// Display text
			Console::WriteLine(portion->get_Text());
		}
	}
}  

    
 
  • 關於 Aspose.Slides for C++ API

    Aspose.Slides API 可用於讀取、寫入、操作 Microsoft PowerPoint 文檔並將其轉換為 PDF、XPS、HTML、TIFF、ODP 和各種其他格式。可以從頭開始創建新文件並將其保存為相關支持的格式。 Aspose.Slides 是一個獨立的 API,用於創建、解析或操作演示文稿、幻燈片和元素,它不依賴於 Microsoft 或 OpenOffice 等任何軟件。

    Online ODP Parser Live Demos

    Extract text and images from ODP documents right now by visiting our Live Demos website . The live demo has the following benefits

      No need to download Aspose API.
      No need to write any code.
      Just upload your ODP files.
      It will be parsed instantly.

    ODP 什麼是 ODP 文件格式

    Files with ODP extension represent presentation file format used by OpenOffice.org in the OASISOpen standard. A presentation file is a collection of slides where each slide can comprise of text, images, formatting, animations, and other media. These slides are presented to audience in the form of slideshows with custom presentation settings. ODP files can be opened by applications that conform to the OpenDocument format (such as OpenOffice or StarOffice).

    閱讀更多

    其他支持的解析文檔

    使用 C++,可以輕鬆解析其他格式,包括。

    PPT (微軟PowerPoint 97-2003)
    PPTX (打開 XML 表示格式)