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 表示格式)